Package com.jgalgo
Class TSPMetricMatchingAppx
- java.lang.Object
-
- com.jgalgo.TSPMetricMatchingAppx
-
-
Constructor Summary
Constructors Constructor Description TSPMetricMatchingAppx()Create a new TSP \(3/2\)-approximation algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PathcomputeShortestTour(Graph g, WeightFunction w)Compute the shortest tour that visit all vertices.
-
-
-
Method Detail
-
computeShortestTour
public Path computeShortestTour(Graph g, WeightFunction w)
Description copied from interface:TSPMetricCompute the shortest tour that visit all vertices.Note that this problem is NP-hard and therefore the result is only the best approximation the implementation could find.
- Specified by:
computeShortestTourin interfaceTSPMetric- Parameters:
g- a graph containing all the vertices the tour must visit, using its edgesw- an edge weight function. In the metric world every three vertices \(u,v,w\) should satisfy \(w((u,v)) + w((v,w)) \leq w((u,w))$- Returns:
- a result object containing the list of the \(n\) vertices ordered by the calculated path
-
-