1 / 30

Approximation Algorithms

Approximation Algorithms. When the best just isn’t possible. Approximation Algorithms. Some NP-Complete problems are too important to ignore Approaches: If input small, run it anyway Consider special cases that may run in polynomial time Use an approximation algorithm.

jeri
Download Presentation

Approximation Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Approximation Algorithms When the best just isn’t possible Jeff Chastine

  2. Approximation Algorithms • Some NP-Complete problems are too important to ignore • Approaches: • If input small, run it anyway • Consider special cases that may run in polynomial time • Use an approximation algorithm Jeff Chastine

  3. How Sloppy Can We Get? • Optimum solution has cost (measured as minimum or maximum) • Cost is produced by approximation algorithm • We can calculate a ratio • We create -approximation algorithms Jeff Chastine

  4. Approximation Schemes • There are also approximation schemes: • Takes in an instance of the problem • Takes in to create a (1+)-approximation alg • Running time can increase quickly: • Example: • Fully polynomial-time approximation scheme • Running time polynomial in and input • Example: Jeff Chastine

  5. Vertex-Cover Problem • Given find a subset s.t. if then either or • Goal: minimize • This problem is NP-Complete • There is a 2-approximation algorithm • No more than twice the size Jeff Chastine

  6. 2-approximation Algorithm APPROX-VERTEX-COVER (G) 1 2 3 while 4 do let be an arbitrary edge of 5 6 remove from every edge incident on 7 return Jeff Chastine

  7. Approximation Walkthrough b c d a e f g Original Graph. Jeff Chastine

  8. Approximation Walkthrough b c d a e f g Pick an arbitrary edge. Here, it’s Jeff Chastine

  9. Approximation Walkthrough b c d a e f g Add those vertices to and remove incident edges Jeff Chastine

  10. Approximation Walkthrough b c d a e f g Pick another arbitrary edge. Here, it’s Jeff Chastine

  11. Approximation Walkthrough b c d a e f g Add those vertices to and remove incident edges Jeff Chastine

  12. Approximation Walkthrough b c d a e f g Pick another edge. Only one left! Jeff Chastine

  13. Approximation Walkthrough b c d a e f g No incident edges, so add to = 6 vertices Jeff Chastine

  14. Optimal Solution b c d a e f g Only 3 vertices! Jeff Chastine

  15. My Question • Why don’t they sort verts by highest degree? • Pick highest degree first • Remove incident edges • Pick next highest and so on Jeff Chastine

  16. Proof • Let A denote edges picked • Optimal solution must include at least an endpoint for each edge in • No two edges share the same endpoint (since we remove incident edges) • No two edges are covered by the same vertex • Thus • Each time an edge is picked, it isn’t in C • Thus and Jeff Chastine

  17. Traveling Salesman Problem • Let be a weighted, non-directed graph • Problem: find a tour of all vertices of minimum weight • Always cheapest to go directly from • Intermediate steps can only add to cost • Called the triangle inequality Jeff Chastine

  18. 2-Approximation Algorithm APPROX-TSP-TOUR(G, c) 1 select a vertex to be a “root” vertex 2 compute a Minimum Spanning Tree from using PRIM’s algorithm • let be the list of vertices in a preorder walk of 4 return the hamiltonian cycle in order Jeff Chastine

  19. Walkthrough a d e g b f c h Original graph with Euclidean distance Jeff Chastine

  20. Walkthrough a d e g b f c h Pick a root vertex Jeff Chastine

  21. Walkthrough a d e g b f c h Build a Minimum Spanning Tree using Prims. Jeff Chastine

  22. Walkthrough 1 5 6 8 2 7 3 4 Do IN-ORDER walk of tree. Jeff Chastine

  23. Walkthrough 1 5 6 8 2 7 3 4 Construct Hamiltonian Tour using order. Distance == 19.074 Jeff Chastine

  24. Optimum Solution a d e g b f c h Optimum solution. Distance == 14.715 Jeff Chastine

  25. Proof • If is the optimum tour, then delete any edge from it and compare with a MST s.t. • A full walk of visits each node twice Jeff Chastine

  26. Walkthrough a d e g b f c h Jeff Chastine

  27. Proof • If is the optimum tour, then delete any edge of it and compare with a MST s.t. • A full walk of visits each node twice • However, W isn’t a tour! • Using triangle inequality to delete • Remove all but first visit to each vertex Jeff Chastine

  28. Walkthrough a d e g b f c h ; same as preorder! Jeff Chastine

  29. Proof • If is the optimum tour, then delete any edge of it and compare with a MST s.t. • A full walk of visits each node twice. Thus • However, isn’t a tour! • Using triangle inequality to delete all but first visit to each vertex (this gives preorder) • If is walk of preorder, then Jeff Chastine

  30. Summary • Don’t give up on NP-Complete algorithms • If input is small, brute-force it! • If input is large, try to develop an approximation algorithm Jeff Chastine

More Related