� 1 r LECTURE 8: GREEDY, LOCAL SEARCH ADVANCED ALGORITHMS
� 2 LECTURE 8 ANNOUNCEMENTS ▸ Homework 2 out Wednesday Friday ▸ Contacting the TAs: adv-algorithms-ta-fall18@googlegroups.com
� 3 LECTURE 8 LAST CLASS ▸ Greedy algorithm for minimum spanning tree ▸ Simple algorithm — add one edge at a time, add one vertex to connected component ▸ Analysis tricky (see lecture notes) ▸ Meta argument — useful strategy to analyze greedy — inductively prove that there exists an optimal solution that includes all greedy choices. a link to Jeff Erickson's notes post Interval scheduling
� 4 LECTURE 8 MAXIMUM COVERAGE part of the input k Hiring problem: suppose we have n people, each with a set of skills from some universe {1,…,m}. Pick k people so as to maximize the total # of distinct skills thni Gree.dz ▸ Each person — set S i ⊆ {1,2,…, m } with person start ▸ Want to maximize union of chosen sets skills with most o l update the value of f oh 7 all the others r pick person with 3 vi o s valve in Max 5 5 jrm times Repeat n
� 5 LECTURE 8 GREEDY ALGORITHM — BUILDING A SOLUTION number of elements in Si that Value of i the sets chosen are not in so far so far K S 5 we picked Say I si l s U 5331 valli ties arbitrarily Break
� 6 LECTURE 8 OPTIMAL? S S 53 Sg ▸ {1,2,3}, {4}, {1,2,4}, {3,5} k 2 union has size _4 greedy S S 1 7 optimum opt _5 Sa Sz ri
� 7 LECTURE 8 CAN GREEDY BE REALLY BAD? No
� 8 LECTURE 8 CAN GREEDY BE REALLY BAD? size of the union of the chosen sets Theorem. “Value” of solution chosen by greedy is at least (1/2) * value of optimal solution. I Ie O 63 ▸ Example of “approximation algorithm” an optimum soles F Last class argument includes the choices that full problem the for so far we've made
� 9 LECTURE 8 HOW TO PROVE THIS? WHAT ABOUT THE FIRST STEP? value of solution yµ Greedy union of the option Let the Y Si L U be denoted sets Y Sis tax I au Si k f claim us Si Us u Yj
14,1 Claim lutz 3 lute Isr It Israel Say S one of them r is 3 lutz Choice of the greedy alg is only better Isi Is Is't ie 1413 I Yal 3 l U 141 1 z ly l t 1 Claim animism above but with just the RED portion
I o � 10 LECTURE 8 KEY OBSERVATION — CAN ALWAYS MAKE “PROGRESS” tj claim 1314g.lt 1 uYI1usYjlzlul lYgjl1Yj.l3lYil l E f lull t ftp t Tu Hit f 114
� 11 LECTURE 8 I Yj l t.ly It t.lu I INDUCTIVE CLAIM l t ly Yjl stowed 1 tIuttiInductinedaim 1H Ll told l lyj1 I I Intuitively distance 1 1481 1 to lul drops a factor by atleast A E
I � 12 LECTURE 8 APPROXIMATION I Ul fi EY 14h13 l Tu E o 631 ul I E lul t
� 13 LECTURE 8 WHAT TO DO WHEN WE DON’T FIND AN OPTIMAL SOLUTION? Can we improve it?
� 14 LECTURE 8 EXAMPLE — MATCHING Matching: suppose we have n children, n gifts and “happiness” values H ij . Assign gifts to children to maximize “total happiness” ▸ We saw: greedy does not give optimal cost
� 15 LECTURE 8 IMPROVING A SOLUTION such that Check if i F children j y improves total swapping the gifts is m in thn Heta
� 16 LECTURE 8 WHAT IF WE CANNOT IMPROVE? Gifts a solution where Children are at I we e ol I J swapping gifts dadoes not A i j 2 it F make the solution better o z where 4 is a fi child i on n permutation t Hj Pj 3 Hi pj Hj ti Hip
� 17 LECTURE 8 WHAT IF WE CANNOT IMPROVE? Theorem. Consider any solution that is “locally optimum”. Its cost is at least (1/2) * OPT 9 i 921 En assignment OPT l Ii H p 1 Hap 1 Hmp 3 f t Hn g 1 H Hag
� 18 LECTURE 8 APPROXIMATION
� 19 LECTURE 8 CLASSIC EXAMPLE — GRADIENT DESCENT Warning: multivariate calculus coming up D ⊆ ℝ n Problem. Given a convex function f over a domain D , find argmin x ∈ D f ( x )
� 20 LECTURE 8 LOCAL SEARCH Problem. Given a convex function f over a domain D , find argmin x ∈ D f ( x )
� 21 LECTURE 8 LOCAL SEARCH Problem. Given a convex function f over a domain D , find argmin x ∈ D f ( x ) ▸ What is a good direction to move? ▸ Need domain D to be convex
Recommend
More recommend