Вы находитесь на странице: 1из 23

Approximation

Algorithms

Presented by:
Ruchi(2018cs17)
 There are many important problems
For which no fast solution !( i.e. only non
polynomial algorithms exist )
 But we want the answer …
If the input is small no problem .One
can use non polynomial algorithm .
otherwise
Find the Near-Optimal solution in
polynomial time.
Ways to Find Near-Optimal
Solution
 Heuristic algorithms or heuristic
 Approximation algorithms
Heuristic
 By a heuristic we mean a procedure that may produce a good or
even optimal sol to your problem if you are lucky,
but on the other hand may produce one that is not even feasible or far
from optimal.
 A heuristic is a common sense rule
drawn from experience rather than from a mathematically proved
assertion.
 There is no mathematical result about the correctness of solution so
obtained
Approximation algorithm
An algorithm that returns near optimal solutions is called approximation
algorithm.
It must be possible to calculate a bound either.
Which is measured in terms of
Difference or ratio between the optimal solution and the one produced
by approximate algorithm.
Goal

 The goal of an approximation algorithm is to come as


close as possible to the optimum value in a
reasonable amount of time which is at most
polynomial time.
 Suppose we have some optimization problem
which has a large number of feasible solutions is
with instance i,
let c(i) be the value of solution produced by
approximate algorithm and
c*(i) be the value of optimal solution.
 For minimization problem, we are interested in
finding a solution of a given instance i (in the set of
feasible solutions), such that
c(i)/c*(i) be as small as possible.
On the other hand,
 for maximization problem, we are interested in
finding a solution in the feasible solution set such
that
 c*(i)/c(i) be as small as possible
Performance measure used:
p(n)
 We say that an approximation algorithm for the given problem
instancei, has a ratio bound of p(n) if for any input of size n,
 the cost c of the solution produced by the approximation
algorithm is within a factor of p(n) of the cost c* of an optimal
solution. That is
max{c(i)/c*(i), c*(i)/c(i)} ≤
p(n)
This definition applies for both
minimization and maximization
problems
Note that p(n) is always greater than or
equal to 1.
 If solution produced by approximation
algorithm is true optimal solution then
clearly we have p(n) = 1.
For a minimization problem,
0 < c*(i) ≤ c(i),
and the ratio c(i)/c*(i) gives the factor by which the
cost of the approximate solution is larger than the
cost of an optimal solution.

Similarly, for a maximization problem,


0 < c(i) ≤ c*(i),
and the ratio c*(i)/c(i) gives the factor by which the
cost of an optimal solution is larger than the cost of
the approximate solution
Some problems solved by
approximate algorithms

 Vertex Cover
Traveling salesman
Bin Packing
Vertex Cover

 Definition: A vertex-cover of an undirected graph


G=(V, E) is a set V’ :a subset of V such that if edge
(u, v) is an edge of G then either u in V’ or v in V` (or
both).
 Problem: Find a vertex-cover of minimum size in
a given undirected graph.
 This optimal vertex-cover is the optimization version
of an NP-complete problem
 but it is not too hard to find a vertex-cover that is
near optimal
There is an 2-approximation algorithm:

what does it mean?

It returns a vertex-cover not


more than twice of the size
optimal solution.
APPROX-VERTEX_COVER (G: Graph)
// C is vertex cover of the given graph
1 c←{}
2 E’ ← E[G]
3 while E’ is not empty do
4 Let (u, v) be an arbitrary edge of E’
5 c ← c U {u, v}
6 Remove from E’ every edge incident on either
u or v
7 return c
C ={ b, c }

C ={ b, c ,e, f} C ={ b, c ,e, f, d,g}

Light colored vertices are taken in the


Optimal vertex
cover = {b,c,d,e,f,g}
cover {b,d,e}
 Analysis
 It is easy to see that the running time of
this approximate algorithm is O(V+E),
using adjacency list to represent E’.
 Theorem: APPROX-VERTEX-COVER is a
polynomial-time 2-approximate algorithm
i.e., the algorithm has a ratio bound of 2.
 Goal: Since this a minimization problem, we are interested in smallest
possible c/c*.
 Specifically we want to show c/c* ≤ 2 = p(n).
 In other words, we want to show that APPROX-VERTEX-COVER
algorithm returns a vertex-cover that is at the most twice the size of
an optimal cover.
Proof: Let the set c and c* be the sets obtained by
APPROX-VERTEX-COVER and OPTIMAL-VERTEX-COVER respectively.
Also, let A be the set of edges selected by line 4.
Because, we have added both vertices,

we get c = 2|A|
but OPTIMAL-VERTEX-COVER would have added one of two.
|c*| ≥ |A | -----1
(no two edges of A are having any common vertex so to
cover only these edges of A we need |A| no of vertices.
In line 4, we picked both end points, we have
|c| = 2|A| ---------------------------------- 2
 Take |c|/2 = |A| and put it in equation 1
|c*| ≥ |c|/2
|c*|/|c| ≥ 1/2
|c |/|c*| ≤ 2 = p(n)
 proving the theorem. □
 APPROX-VERTEX-COVER algorithm returns a vertex-
cover that is at most twice the size of an optimal cover
in polynomial time.
Queries??
Thank You!

Вам также может понравиться