Approximation Algorithm
Approximation Algorithm
Vinila Jinny
Introduction
Approximation algorithms are used to get a
solution close to the (optimal) solution of an
optimization problem in polynomial time
For example, Traveling Salesman Problem (TSP)
is an optimization problem (the route taken has
to have minimum cost).
Since TSP is NP-Complete, approximation
algorithms allow for getting a solution close to
the solution of an NP problem in polynomial
time.
Why Approximation?
An Approximate Algorithm is a way of
approach NP-COMPLETENESS for the
optimization problem.
This technique does not guarantee the best solution.
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 the most
polynomial time. Such algorithms are called
approximation algorithm or heuristic algorithm.
Why Approximation?
For the traveling salesperson problem, the
optimization problem is to find the shortest cycle,
and the approximation problem is to find a short
cycle.
For the vertex cover problem, the optimization
problem is to find the vertex cover with fewest
vertices, and the approximation problem is to find
the vertex cover with few vertices.
Definition
An algorithm is an α-approximation algorithm for an
optimization problem Π if
1. The algorithm runs in polynomial time
2. The algorithm always produces a solution that is
within a factor of α of the optimal solution
Minimization – α < 1
Maximization – α > 1
Vertex Cover Problem
A Vertex Cover of a graph G is a set of vertices such
that each edge in G is incident to at least one of these
vertices.
Approximate Algorithm
Approx-Vertex-Cover (G = (V, E))
{
C = empty-set;
E'= E;
While E' is not empty do
{
Let (u, v) be any edge in E': (*)
Add u and v to C;
Remove from E' all edges incident to
u or v;
}
Return C;
}
Idea
The idea is to take an edge (u, v) one by one,
put both vertices to C,
remove all the edges incident to u or v.
We carry on until all edges have been removed.
C is a VC.
Example
Example of Vertex
Cover
Possible Solutions are: The Graph
1. { 1, 3, 4 }
1
2. { 1, 7, 5 }
2
If the weights are the 7
vertex numbers, then
the optimal solution 3
is: {1, 3, 4} 6
4
5
Travelling Salesman
Problem
In the traveling salesman Problem, a
salesman must visits n cities.
We can say that salesman wishes to make a
tour or Hamiltonian cycle, visiting each city
exactly once and finishing at the city he starts
from.
Travelling Salesman
Problem
There is a non-negative cost c (i, j) to travel
from the city i to city j.
The goal is to find a tour of minimum cost.
We assume that every two cities are
connected. Such problems are called
Traveling-salesman problem (TSP).
Travelling Salesman
Problem
We can model the cities as a complete graph
of n vertices, where each vertex represents a
city.
It can be shown that TSP is NPC.
If we assume the cost function c satisfies the
triangle inequality, then we can use the
following approximate algorithm.
Triangle inequality
Let u, v, w be any three vertices, we have