Download presentation
Presentation is loading. Please wait.
1
Computability and Complexity 24-1 Computability and Complexity Andrei Bulatov Approximation
2
Computability and Complexity 24-2 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) Optimization Problems In an optimization problem, for every possible instance x we have a set S(x) of feasible solutions for every solution y S(x), we have a positive goodness m(x,y) optimization parameter opt { min, max }
3
Computability and Complexity 24-3 Relative Error Sometimes it is sufficient to find an approximate solution Definition The relative error of a solution y (with respect to an instance x ) is In a maximization problem m(x,y) is always smaller than OPT(x), so the relative error lies between 0 and 1 In a minimization problem the relative error can be arbitrarily large
4
Computability and Complexity 24-4 Approximation Algorithms Definition An algorithm A is an -approximating algorithm for an optimization problem if, for any instance x, A computes a feasible solution with relative error less than in a time which is polynomial in |x| Definition A problem is approximable if it has an -approximating algorithm for some
5
Computability and Complexity 24-5 Example Consider the following naive algorithm for solving Minimal Vertex Cover on the graph (V,E) Set M = While E do - Pick any edge e and add both endpoints to M - Remove e from E, and also remove all incident edges from E Is this an -approximating algorithm?
6
Computability and Complexity 24-6 The naive algorithm is a 1-approximating algorithm for Minimal Vertex Cover The cover chosen contains disjoint edges Hence any cover must contain at least vertices Hence the relative error is at most 1 Surprisingly, this is the best approximation algorithm possible!
7
Computability and Complexity 24-7 Example Consider the following greedy algorithm for solving Minimal Vertex Cover on the graph (V,E) Set M = While E do - Pick a vertex with the highest degree and add it to M - Remove this vertex from V, and also remove all incident edges from E Is this an -approximating algorithm?
8
Computability and Complexity 24-8 Max - SAT Instance: A formula in CNF. Objective: Find an assignment for that satisfies the maximal number of clauses Max-SAT Theorem There is a 1/2-approximating algorithm for Max-SAT Theorem There is a 1/2-approximating algorithm for Max-SAT
9
Computability and Complexity 24-9 Satisfying Clauses We present an algorithm which, given a formula , computes a solution with relative error at most where k is the minimal number of literals in a clause of Let and has literals The probability that a random assignment to the variables of satisfies is Therefore, the expected number of clauses satisfied by a random assignment
10
Computability and Complexity 24-10 In a similar way we can compute and It follows from Probability Theory that Therefore
11
Computability and Complexity 24-11 Algorithm for i = 1 to n do Given CNF , let be variables in compute and if then set otherwise set return the assignment
12
Computability and Complexity 24-12 Analysis The algorithm builds a sequence of formulas such that Consider formula. It contains no variables, therefore is the number of satisfied clauses Compute the relative error. Since OPT( ) n
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.