Class SalesmanPruning
java.lang.Object
topics.backtracking.tsp.HamiltonianAll
topics.backtracking.tsp.Salesman
topics.backtracking.tsp.SalesmanPruning
TSP Optimization with Pruning (Bounding)
This class implements Branch invalid input: '&' Bound by pruning branches that exceed
the current bestCost.
Bounding Principle
If currentCost + edgeCost >= bestCost, we stop exploring this path.
This is the crucial heuristic that makes this algorithm usable for slightly larger N.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbacktrack(int current) Core backtracking logic following the Choose-Explore-Unchoose paradigm.Methods inherited from class Salesman
getBestCost, getBestPathMethods inherited from class HamiltonianAll
backtracking, getNumberSolutions
-
Constructor Details
-
SalesmanPruning
public SalesmanPruning(int n, int source, int[][] weights)
-
-
Method Details
-
backtrack
protected void backtrack(int current) Description copied from class:HamiltonianAllCore backtracking logic following the Choose-Explore-Unchoose paradigm.
-