0% found this document useful (0 votes)
33 views24 pages

Chap 4

An approximate algorithm aims to find a near-optimal solution to an NP-complete problem in polynomial time, rather than guaranteeing an optimal solution. For problems like traveling salesman and vertex cover, the approximate problem is to find a short tour or small cover, rather than the absolute shortest or smallest. Performance ratios measure how suboptimal an approximate solution is compared to the optimal by comparing costs. Common search algorithms used in approximation algorithms include breadth-first search, depth-first search, and depth-limited search.

Uploaded by

Hamze Ordawi1084
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views24 pages

Chap 4

An approximate algorithm aims to find a near-optimal solution to an NP-complete problem in polynomial time, rather than guaranteeing an optimal solution. For problems like traveling salesman and vertex cover, the approximate problem is to find a short tour or small cover, rather than the absolute shortest or smallest. Performance ratios measure how suboptimal an approximate solution is compared to the optimal by comparing costs. Common search algorithms used in approximation algorithms include breadth-first search, depth-first search, and depth-limited search.

Uploaded by

Hamze Ordawi1084
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Chapter-4: Approximation

algorithms

By Dr.Rinesh.S
Approximate Algorithms
• 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.
• 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.
Performance Ratios

• Suppose we work on an optimization problem where every solution


carries a cost. An Approximate Algorithm returns a legal solution, but
the cost of that legal solution may not be optimal.
• For Example, suppose we are considering for a minimum size
vertex-cover (VC). An approximate algorithm returns a VC for us, but
the size (cost) may not be minimized.
• Another Example is we are considering for a maximum size
Independent set (IS). An approximate Algorithm returns an IS for us,
but the size (cost) may not be maximum. Let C be the cost of the
solution returned by an approximate algorithm, and C* is the cost of
the optimal solution.
• Intuitively, the approximation ratio measures how bad the approximate
solution is distinguished with the optimal solution. A large (small)
approximation ratio measures the solution is much worse than (more
or less the same as) an optimal solution.
• Observe that P (n) is always ≥ 1, if the ratio does not depend on n,
we may write P. Therefore, a 1-approximation algorithm gives an
optimal solution. Some problems have polynomial-time approximation
algorithm with small constant approximate ratios, while others have
best-known polynomial time approximation algorithms whose
approximate ratios grow with n.
Traveling-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.
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).
• We can model the cities as a complete graph of n vertices, where each
vertex represents a city.
What is Linear Programming?

• linear programming is a technique that helps us to find the optimum solution for a given problem,
an optimum solution is that solution that is the best possible outcome of a given particular problem.
• In simple terms, it is the method to find out how to do something in the best possible way in given
limited resources you need to do the optimum utilization of resources to achieve the best possible
result in a particular objective. such as least cost, highest margin, or least time on those resources
have alternate uses.
• The situation which requires a search for best values of the variables subject to certain constraints
are amendable programming analysis.
• These situations cannot be handled by the usual tools of Calculus or marginal analysis. The
calculus technique can only handle exactly equal constraints while this limitation does not exist in
the case of linear programming problems. A linear programming problem has two basic parts:
• First Part: It is the objective function that describes the primary purpose of the formation to
maximize some return or to minimize some.
• Second Part: It is a constant set, It is the system of equalities or inequalities which describe the
condition or constraints of the restriction under which Optimisation is to be accomplished.
What is a primal-dual algorithm?
• The primal-dual algorithm is a method for solving linear programs
inspired by the Ford–Fulkerson method. Instead of applying the
simplex method directly, we start at a feasible solution and then
compute the direction which is most likely to improve that solution.
Heuristic search strategies
• A heuristic search technique is a type of search performed by
artificial intelligence (AI) that looks to find a good solution, not
necessarily a perfect one, out of the available options.
Search Algorithm Terminologies:
Types of search algorithms
1. Breadth-first Search:

• Breadth-first search is the most common search strategy for traversing a tree or graph. This
algorithm searches breadthwise in a tree or graph, so it is called breadth-first search.
• BFS algorithm starts searching from the root node of the tree and expands all successor node at the
current level before moving to nodes of next level.
• The breadth-first search algorithm is an example of a general-graph search algorithm.
• Breadth-first search implemented using FIFO queue data structure.
• Advantages:
• BFS will provide a solution if any solution exists.
• If there are more than one solutions for a given problem, then BFS will provide the minimal
solution which requires the least number of steps.
• Disadvantages:
• It requires lots of memory since each level of the tree must be saved into memory to expand the
next level.
• BFS needs lots of time if the solution is far away from the root node.
Example:
2. Depth-first Search

• Depth-first search isa recursive algorithm for traversing a tree or graph data structure.
• It is called the depth-first search because it starts from the root node and follows each path to its greatest
depth node before moving to the next path.
• DFS uses a stack data structure for its implementation.
• The process of the DFS algorithm is similar to the BFS algorithm.
• Note: Backtracking is an algorithm technique for finding all possible solutions using recursion.
• Advantage:
• DFS requires very less memory as it only needs to store a stack of the nodes on the path from root node to
the current node.
• It takes less time to reach to the goal node than BFS algorithm (if it traverses in the right path).
• Disadvantage:
• There is the possibility that many states keep re-occurring, and there is no guarantee of finding the solution.
• DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
Example:
3. Depth-Limited Search Algorithm:

• A depth-limited search algorithm is similar to depth-first search with a predetermined


limit. Depth-limited search can solve the drawback of the infinite path in the Depth-first
search. In this algorithm, the node at the depth limit will treat as it has no successor
nodes further.
• Depth-limited search can be terminated with two Conditions of failure:
• Standard failure value: It indicates that problem does not have any solution.
• Cutoff failure value: It defines no solution for the problem within a given depth limit.
• Advantages:
• Depth-limited search is Memory efficient.
• Disadvantages:
• Depth-limited search also has a disadvantage of incompleteness.
• It may not be optimal if the problem has more than one solution.
Example:

You might also like