240 likes | 608 Views
32. Traveling Salesperson Problem. TSP : Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D?. All 13,509 cities in US with a population of at least 500 Reference: http://www.tsp.gatech.edu. Traveling Salesperson Problem.
E N D
Traveling Salesperson Problem • TSP: Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? All 13,509 cities in US with a population of at least 500Reference: http://www.tsp.gatech.edu
Traveling Salesperson Problem • TSP: Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? Optimal TSP tour Reference: http://www.tsp.gatech.edu
Traveling Salesperson Problem 11,849 holes to drill in a programmed logic array Reference: http://www.tsp.gatech.edu
Traveling Salesperson Problem Optimal TSP tour Reference: http://www.tsp.gatech.edu
Traveling Salesperson Problem • TSP: given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? • HAM-CYCLE: given a graph G = (V, E), does there exists a simple cycle that contains every node in V? • Claim: HAM-CYCLE P TSP • Pf: • Given instance G = (V, E) of HAM-CYCLE, create n cities with distance function • TSP instance has tour of length n iff G has Hamiltonian cycle
3-Dimensional Matching • Example: Given n instructors, n courses, and n times, and a list of the possible courses and times each instructor is willing to teach, is it possible to make an assignment so that all courses are taught at different times? Instructor Course Time Wayne COS 423 MW 11-12:20 Wayne COS 423 TTh 11-12:20 Wayne COS 226 TTh 11-12:20 Wayne COS 126 TTh 11-12:20 Tardos COS 523 TTh 3-4:20 Tardos COS 423 TTh 11-12:20 Tardos COS 423 TTh 3-4:20 Kleinberg COS 226 TTh 3-4:20 Kleinberg COS 226 MW 11-12:20 Kleinberg COS 423 MW 11-12:20
3-Dimensional Matching • 3D-MATCHING: Given disjoint sets X, Y, and Z, each of size n and a set T X Y Z of triples, does there exist a set of n triples in T such that each element of X Y Z is in exactly one of these triples? • Claim: 3-SAT P3D-MATCHING • Pf: Given an instance of 3-SAT, we construct an instance of 3D-matching that has a perfect matching iff is satisfiable
3-Dimensional Matching • Construction (part 1) • Create gadget for each variable xi with 2k core and tip elements • No other triples will use core elements • In gadget i, 3D-matching must use either both grey triples or both blue ones number of clauses set xi = true set xi = false false clause 1 tips core true k = 2 clausesn = 3 variables x2 x3 x1
3-Dimensional Matching • Construction (part 2) • Now we add elements to model the clauses and to constrain the assignments we can choose • In the language of 3D-matching, the clause tells us: “The matching on the cores of the gadgets should leave the grey tips of the first gadget free; or it should leave the blue tips of the second gadget free; or it should leave the grey tips of the third gadget free”
3-Dimensional Matching • Construction (part 2) • For each clause Cj create two core elements and three triples • Exactly one of these triples will be used in any 3D-matching • For sample clause j, ensures any 3D-matching uses either (i) grey core of x1 or (ii) blue core of x2 or (iii) grey core of x3 clause j gadget false clause 1 tips core true x2 x3 x1
3-Dimensional Matching • Almost done with the construction, but there’s still one problem • Suppose the set of clauses has a satisfying assignment • Then we make corresponding choices of grey/blue for each variable gadget • But this leaves at least one free tip for each clause gadget
3-Dimensional Matching • Construction (part 3) • For each tip, add a cleanup gadget clause 1 gadget cleanup gadget false clause 1 tips core true x2 x3 x1
3-Dimensional Matching • Suppose there is a perfect 3D-matching in the instance we have constructed • In each variable gadget xi the matching chooses either all the grey triples or all the blue triples • grey set xi = 1 in the 3-SAT instance • blue set xi = 0 in the 3-SAT instance • Consider clause Cj; has it been satisfied? • Yes, the two core elements have been covered and thus at least one of the three variable gadgets corresponding to a term in Cjmade the “correct” grey/blue decision; this induces a variable assignment that satisfies Cj • But, have we constructed a 3D-matching? What are the X, Y, and Z sets?
3-Dimensional Matching • Claim: Instance has a 3D-matching iff is satisfiable • Detail: What are X, Y, and Z? Does each triple contain one element from each of X, Y, Z? clause 1 gadget cleanup gadget false clause 1 tips core true x2 x3 x1
3-Dimensional Matching • Claim: Instance has a 3D-matching iff is satisfiable • Detail: What are X, Y, and Z? Does each triple contain one element from each of X, Y, Z? clause 1 gadget cleanup gadget clause 1 tips core x2 x3 x1