150 likes | 250 Views
Computability and Complexity. 23-1. Search and Optimization. Computability and Complexity Andrei Bulatov. Computability and Complexity. 23-2. Search Problems. Often we need to find a solution to some problem, rather than to show that a solution exists.
E N D
Computability and Complexity 23-1 Search and Optimization Computability and Complexity Andrei Bulatov
Computability and Complexity 23-2 Search Problems Often we needto find a solution to some problem, rather than to show that a solution exists In this case the problem is said to be a search problem Hamilton Circuit(S) Instance: A finite graph G. Objective: Find a Hamilton Circuit in G, or report it does not exist
Computability and Complexity 23-3 More Examples Colouring(S) Instance: A finite graph G and an integer K. Objective: Find a colouring of G with K colours or report it does not exist Satisfiability(S) Instance: A conjunctive normal form . Objective: Find a satisfying assignment for or report it does not exist
Computability and Complexity 23-4 Reduction to Decision Versions Search problems look much more practical than decision problems, but we have studied mostly decision problems because: • there always is the decision version of a search problem • complexity classes, reducibility, etc. for decision problems • are simpler than those for search problems • normally, if we know how to solve a decision problem, we can • also solve its search version
Computability and Complexity 23-5 Reduction for Satisfiability We use an algorithm for the decision version as an oracle Given a formula with the set of variables V • For every X V do • If has a satisfying assignment set X = 0 - otherwise, if has a satisfying assignment set X = 1 otherwise report “there is no solution” • output the obtained assignment
Computability and Complexity 23-6 Reduction for HamCircuit G: Observation: v A graph G has a Hamilton Path from u to v if and only if the following graph has a Hamilton Circuit u v u
Computability and Complexity 23-7 Given a graph G with vertex set V • take a vertex • set H := G • for i= 1 to |V| –1 do • for every neighbour v of do - if there is a Hamilton path in H from to v then set remove and all adjacent edges from H • until is defined • if is not defined then output “there is no Hamilton Circuit” • output the Hamilton Circuit
Computability and Complexity 23-8 Optimization Problems In some problems we seek to find the best solution among a collection of possible solutions Problems of this type are called optimization problems Definition An optimization problem is a 4-tuple (I,S,m,opt), where • I is a set of possible instances (encoded by strings over • some alphabet • S is a function mapping each instance to a set of • feasible solutions • m is a function mapping pairs of instances and • solutions to a positive measure of goodness • opt is either max or min, and indicates whether we • seek maximum or minimum goodness
Computability and Complexity 23-9 To solve an optimization problem we must find for any given x I, a solution y S(x) such that The optimal value will be denoted OPT(x)
Computability and Complexity 23-10 Example Travelling Salesperson(O) Instance: A finite set of cities , and a positive integer distance , between each pair . Objective: Find a permutation of that minimizes • I contains sets of cities and distances • S gives the set of all possible orderings for each instance • m gives the length of the tour for each instance and choice of ordering • opt is min, because we seek for a shortest tour
Computability and Complexity 23-11 Example Minimal Vertex Cover¹ Instance: A graph G = (V,E). Objective: Find a smallest set M N such that for each edge (u,v) E we have u,v M ¹Sometimes called Min Node Cover or just Minimum Cover • I contains all graphs • S gives the set of all vertex covers for each graph • m gives the size of the vertex cover (the number of vertices) • opt is min, because we seek for a smallest vertex cover
Computability and Complexity 23-12 NP-Hard By extending the notion of reduction, we can show that many optimization problems are hard to solve Algorithms for the examples above would allow us to solve the corresponding decision problems, which are all NP-complete We will call a problem NP-hard if all problems in NP are reducible to it in polynomial time
Computability and Complexity 23-13 Reduction for TSP Given a set of cities and distances First, we find the length of the shortest tour • set L := 0 and • do - set - if there is a tour of length M then set U := M - otherwise set L := M • until L = U • return L
Computability and Complexity 23-14 Now we can find a shortest tour. Let its length be denoted L and let B = 2L • set • for i = 1 to n –1 do • for every do - suppose - set and otherwise • if there is a tour for and • of length then set set and • until is defined • output the shortest tour
Computability and Complexity 23-15 Both, search and optimization problems can be reduced to decision problems Why optimization problems are more interesting? Because we can approximate…