advanced algorithms
play

ADVANCED ALGORITHMS 2 LECTURE 9 ANNOUNCEMENTS a bit lengthy Cask - PowerPoint PPT Presentation

1 LECTURE 9: LOCAL SEARCH, SHORTEST PATH ADVANCED ALGORITHMS 2 LECTURE 9 ANNOUNCEMENTS a bit lengthy Cask for clarifications Homework 2 out due next Friday Contacting the TAs: adv-algorithms-ta-fall18@googlegroups.com 3


  1. � 1 LECTURE 9: LOCAL SEARCH, SHORTEST PATH ADVANCED ALGORITHMS

  2. � 2 LECTURE 9 ANNOUNCEMENTS a bit lengthy Cask for clarifications ▸ Homework 2 out — due next Friday ▸ Contacting the TAs: adv-algorithms-ta-fall18@googlegroups.com

  3. � 3 LECTURE 9 LAST CLASS O 63 times Approximation algorithm opt ▸ Greedy algorithm has a non-trivial approximation guarantee ▸ Analysis the tricky part of greedy algorithms ▸ Local search — start with any feasible solution, improve it

  4. � 4 LECTURE 9 EXAMPLE — MATCHING Matching: suppose we have n children, n gifts and “happiness” values H ij . Assign gifts to children to maximize “total happiness” ▸ Local search algorithm: ▸ Start with any assignment ▸ For each pair of children, see if “swapping gifts” improves total cost i

  5. � 5 LECTURE 9 NO IMPROVEMENT => INEQUALITY a perm ta te n H of l n ▸ Denote “locally optimal” solution by assignment p 1 , p 2 , …, p n Vij H i , p i + H j , p j ≥ H i , p j + H j , p i we would have swapped because otherwise gifts of children i j

  6. � 6 LECTURE 9 LOCALLY OPTIMUM => APPROXIMATELY OPTIMAL Theorem. Consider any solution that is “locally optimum”. Its cost is at least (1/2) * OPT ▸ Denote “locally optimal” solution by assignment q 1 , q 2 , …, q n vahyof Hiq we found value of solution Hi pi

  7. � 7 LECTURE 9 APPROXIMATION Let j be the index q that was assigned Ep our solution in ti I Pj e hi E O 5 Hi.aitHj pi3 HIIi Hi.it iai 11 111 value ofoPT Hj Qi solution valostanour 111 of our sobs val 2x

  8. � 8 LECTURE 9 CLASSIC EXAMPLE — GRADIENT DESCENT I Warning: multivariate calculus coming up f f IR 7112 n o D ⊆ ℝ n Problem. Given a convex function f over a domain D , find fonnex argmin x ∈ D f ( x ) IF tnIm fh.tn 7 f.tHt 1 affulth Hfly V Telo A

  9. satisfies fluty a f belt fly f Fact If 2 min of f then convex domain D the over a is unique is

  10. � 9 LECTURE 9 LOCAL SEARCH Problem. Given a convex function f over a domain D , find argmin x ∈ D f ( x ) with any start lookat all ft in bis e It if one of them ftp.o has lower f 17 move to value that nbr continue

  11. fi IR IR Start with in D any center raps D o Bank an Algorithm a yE Balling yfp't if flu n fly move The figana locally optimal ptf y repeat This will always find the Claim min for f value a n't Xn I y fly E Xfln 11 a If flat sik flat then fly c flu

  12. � 10 LECTURE 9 LOCAL SEARCH Problem. Given a convex function f over a domain D , find argmin x ∈ D f ( x ) an easy ▸ What is a good direction to move? is this ▸ Need domain D to be convex just step in the direction move opposite the gradient

  13. � 11 LECTURE 9 COMMENTS ON GRADIENT DESCENT ▸ How many steps to take? ▸ What is the step size ? (should it be fixed?) forinash algorithm in ML Perhaps the most used

  14. � 12 LECTURE 9 LOCAL SEARCH SUMMARY ▸ Start with solution, move to “neighboring” solution by changing current solution slightly ▸ How neighbors are chosen determines complexity ▸ Not always optimal in Hw 2 ▸ Number of steps can be LARGE if not done carefully — standard trick: always make sure you improve by significant amount

  15. � 13 LECTURE 9 GRAPH ALGORITHMS

  16. � 14 LECTURE 9 t GRAPH BASICS ANTI ▸ Common data structures — adjacency lists, adjacency matrix ▸ Basic procedures: Breadth first search, depth first search ▸ TODAY: shortest paths — one of the first polynomial time algorithms! 1950 s

  17. � 15 LECTURE 9 u luv SHORTEST PATH PROBLEM n If even tons Shortest path: given a (possibly directed) graph G = (V, E), and two vertices u, v , find the length of the shortest path from u to v BFSfinds the shortest path ▸ What if the graph is not weighted? 7 ▸ Negative weight edges? us edge weights 1 Edge of wt 3

  18. � 16 LECTURE 9 BFS + DISTANCE UPDATES? U uol.ae H v E G maintain o BFS initialized using distfu see if an edge ij W for distlittlij distfj d is incorrect we know that distfj distlj dist filthy

  19. � 17 LECTURE 9 DISTANCE UPDATES — FULL ALGORITHM

  20. � 18 LECTURE 9 CORRECTNESS

  21. � 19 LECTURE 9 DIJKSTRA’S ALGORITHM — CAN WE AVOID MULTIPLE VISITS?

  22. � 20 LECTURE 9 DIJKSTRA’S ALGORITHM

Recommend


More recommend