Class SalesmanPruning


public class SalesmanPruning extends Salesman

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.

  • Constructor Details

    • SalesmanPruning

      public SalesmanPruning(int n, int source, int[][] weights)
  • Method Details

    • backtrack

      protected void backtrack(int current)
      Description copied from class: HamiltonianAll
      Core backtracking logic following the Choose-Explore-Unchoose paradigm.
      Overrides:
      backtrack in class Salesman
      Parameters:
      current - The current node being visited.