Approximation Algorithm To Solve Computer Science Essay

Traveling salesman job is a NP complete job and can be solved utilizing estimate algorithm. It is a minimisation job starting and coating at a specified vertex after holding visited each other vertex precisely one time. Often, the theoretical account is a complete graph. An algorithm that returns near-optimal solutions is called estimate algorithms. Through analyzing the Metric TSP the public presentation of estimate algorithm can be improved significantly utilizing graphical analysis of crossing trees and deepness foremost hunt and implementing a parallel algorithm/program to happen a way with about minimal going cost.

Keywords- TSP, estimate algorithm


Traveling salesman job predicts the shortest possible path to link different metropoliss based on given distances between each metropolis. Here each metropolis should be traversed merely one time and eventually the individual following the path should make to the get downing point of the journey with the minimum cost of the whole journey.

Solving a TSP requires application of many graph algorithms which are helpful in analyzing the TSP and therefore the in happening the optimum solution of TSP.

Get quality help now
checked Verified writer
star star star star 4.7 (348)

“ Amazing as always, gave her a week to finish a big assignment and came through way ahead of time. ”

avatar avatar avatar
+84 relevant experts are online
Hire writer

We call the solution optimal because TSP is a NP hard job it means TSP can non be solved in multinomial clip that is, it is at least difficult as hardest job in NP. TSP is a challenge to the field of algorithms, many researches are traveling on to happen the solution for TSP and therefore for the set of NP difficult jobs.

But optimum solutions can be found utilizing algorithms such as

Exponential Time Algorithm

Pseudo Polynomial Time Algorithm

Approximation algorithm

There is a 3rd attack ; Approximation algorithms are utile in happening near optimum solutions which are helpful in anticipations, determination jobs, operational research, and hunt jobs.

Get to Know The Price Estimate For Your Paper
Number of pages
Email Invalid email

By clicking “Check Writers’ Offers”, you agree to our terms of service and privacy policy. We’ll occasionally send you promo and account related email

"You must agree to out terms of services and privacy policy"
Write my paper

You won’t be charged yet!

These estimate algorithms have the end product which do non divert much with the optimum solution for the given job and solves the intent. Approximation algorithms are demonstrably fast and run in multinomial clip and supply us with a solution slightly near to the optimum solution.

Approximation algorithms are used for maximization or minimisation based on the job. When it comes to Travelling Salesman Problem, it is a minimisation job as the undertaking is to minimise the entire cost of a unit of ammunition trip starting and coating at a specified vertex after holding visited each other vertex precisely one time. Often, the theoretical account is a complete graph ( i.e. each brace of vertices is connected by an border ) . If no way exists between two metropoliss, adding an randomly long border will finish the graph without impacting the optimum circuit.

In the symmetric TSP, the distance between two metropoliss is the same in each opposite way, organizing an adrift graph. This symmetricalness halves the figure of possible solutions while in the asymmetric TSP, waies may non be in both waies or the distances might be different, organizing a directed graph.

For the job of input size 'n ' the estimate ratio ? ( N ) is defined the upper limit of the ratio of the approximative solution to that of the optimum solution and optimum solution to the estimate.That is,

Therefore the algorithms with the estimate ratio of ? ( N ) are called as ? ( N ) - Estimate algorithm. Approximation ratio is ever greater than 1 besides in instance of ? ( N ) = 1 the algorithms gives the optimum solution.

Metric TSP

Here we consider a particular instance of Traveling Salesman Problem named Metric TSP which is a NP complete job. Metric TSP has some restraints,

If graph G denotes the web of the metropoliss where all the vertices represent metropoliss and the borders represent the way between them, First It should non hold any self-loop, 2nd there is precisely one way which is bi-directed with minimum border cost between two vertices, Besides if a direct way exists between the two vertices so that way is smallest when compared with any other indirect way that is through other nodes that is vertices should keep triangle inequality restraint.

These restraints can be written in mathematical for as,

Graph G specified as an n ten n Matrix D in which D [ I, J ] denotes the distance between the vertices I and j such that D forms a metric, i.e.

For all one D [ I, one ] =0

For all i.j D [ I, J ] =D [ J, I ]

For all I, J, k D [ I, J ] & A ; lt ; = D [ I, K ] + D [ K, J ]

End product of the estimate algorithm will be a rhythm in the graph go throughing through all vertices precisely one time such that the amount of distances associated with the borders in the rhythm is every bit little as possible.

Advantage of utilizing estimate algorithm for TSP

Approximation algorithms are utile in estimate of optimum traverse for a given set of metropoliss or nodes. When the accurate consequences are non necessary agencies you do n't necessitate to hold the exact solution but an estimate or a solution near to the optimum solution is sufficient and the clip affairs. As stated above in this TSP is an NP -Hard job which do non hold any algorithm which can happen the optimum solution in multinomial clip. Approximation algorithms provide with a close optimum solution with in multinomial clip.

V. Related plants and Existing Solution

Metric TSP is NP-complete hence there exists a 2-approximation algorithm for to come close the solution with the estimate ratio ? ( n ) of 2where N is the figure of metropoliss to track. For this estimate algorithm, the weight of a minimal weight L crossing tree T of G ( with D the weight matrix ) is a lower edge on the length of an optimum circuit on G which is proved if any border is removed from that crossing corner the graph gets disconnected. Hence the cost of the way is at least equal to the weight of crossing tree.

The upper edge is the length of deepness first hunt of the crossing tree with the minimum weight. That is twice the weight of the crossing tree equal to 2L.Hence the optimum solution C lies in { L, 2L } .

L & A ; lt ; C ? 2L

Existing consecutive 2-Approximation Algorithm

Find T = MST of G for weight matrix D. Weight ( T ) = L

Find E = Sequence of vertices visited in DFS of T

V appears more than one time in E, Delete foremost visual aspect.

Repeat the old measure while possible.

Return E.

There is non a specific algorithms specified to utilize for the coevals of crossing while work outing TSP besides the consecutive deepness foremost search holding high complexness of O ( |V|+|E| ) .Over all the 2-approximation algorithm for the metric TSP job is a executable and operates really rapidly still the bing consecutive algorithms is non every bit fast as it should be while executed on the multicore system environment because it can non use the CPU 's or togss available freely for calculation and hence over lading a individual nucleus or processing unit which is a disadvantages of bing solution.

Proposed solution

When it comes to rush and clip complexness the above series algorithm takes more clip to put to death and non a executable solution to the job for acquiring estimate for metric TSP. This paper better the 2-approimation algorithm and proposes a new algorithm for metric TSP which is once more a 2-approimation but it takes lesser clip to put to death and to acquire a solution for minimisation job of Metric TSP.

This algorithms generates the crossing tree utilizing Prim 's algorithms which has clip complexness of O ( E + V log V ) , usefulness of Prims algorithms comes when there are more figure of borders in to the graph, it performs faster. After acquiring the crossing tree, the tree is traversed utilizing deepness foremost traverse in which usage of correspondence and recursion provides with an efficient algorithm for the Metric TSP besides the complexness of the algorithm depends on the figure of processor or nucleus put to deathing the algorithm.

Parallel 2-approximation algorithm for metric TSP

Parallel algorithm for the 2-approximation algorithm of metric TSP

Graph G denotes the web of metropoliss to track

D is the Adjacency cost matrix of G

C array of vertices traversed as the solution


sol_tsp ( graph G with matrix D )

Generate crossing tree T for the Graph G with the root node a.

C [ 0 ] = a ;

Name p_approx_tsp ( a ) ;

Store the return of the map call in C array get downing from C [ 1 ] .

Return C and cost of traverse.

//p_approx_tsp map used above will be

p_approx_tsp ( P )

Omega: 2-d array where Z [ ? ] denotes the return of the map call p_approx_tsp ( ? )

i=0 ;

//Execute for in analogue or delegate the call p_approx_tsp ( ? ) to work pool to be executed by the togss running in analogue.

For all nodes ? connected to p

call p_approx_tsp ( ? )

shop return in Z [ ? ]

increase I by 1 ;

//each p_approx_tsp call is independent hence can be executed in analogue

Y: array of nodes as solution by the map

k=0 ;

for J = 0. . . I

h=0 ;

while Z [ J ] non empty

Y [ K ] = Z [ J ] [ H ] ;

increase K by 1 ;

terminal for

Y [ K ] =a ;

return Y ;

Experimental plants and flow of algorithm

The above analogue algorithm for the estimate of metric TSP provides us with the solution with the estimate ratio ? of 2 but the clip to happen the solution is reduced significantly.

The burden is balanced on the processors which improves the public presentation of the codification and reduces the operating expense of complex computations on a individual processor. A little set of metropoliss is traced for the solution for understanding the flow of parallel algorithm.

Measure 1:

With the root node A when the algorithm farther returns we found the approximative solution for the metric TSP job in a parallel and recursive mode.

Hence we get the solution as,

A G F D E C B A and the cost will be 53

Measure 2:

This will be the about optimum solution,

Further for the larger job size the algorithm is scalable every bit good as for multicore processors with n figure of nucleuss and hence can be a improvisation of 2-approximation.

Consequences and decision

Therefore the parallel 2-approximation algorithm will supply us with a close optimum solution with an important decrease in the clip to bring forth near optimum solution. The usage of Prim 's algorithm for coevals of crossing tree helps to pull off the dense graphs and the parallelization and recursive calculation of the solution reduces the complexness and therefore the public presentation.

Future work

Future works include the improvisation in the complexness of this algorithm. There exist 4/3 estimate and 1.5 estimate algorithms for metric TSP which are extremely complex hence utilizing parallelization for those algorithms may assist in cut downing their complexness, and executing clip. Optimization of general TSP without restraints and farther more applications of TSP, parallel algorithms and graph theory will be countries of research.

Updated: Jun 05, 2020
Cite this page

Approximation Algorithm To Solve Computer Science Essay. (2020, Jun 01). Retrieved from

Approximation Algorithm To Solve Computer Science Essay essay
Live chat  with support 24/7

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment