Class NearestCityPairHeuristic

  • All Implemented Interfaces:

    public final class NearestCityPairHeuristic
    extends Object
    implements ConstructiveHeuristic<Permutation>
    This class implements a constructive heuristic for the TSP that prefers the first city of the nearest pair of cities. Since the stochastic sampling algorithms of the library require higher heuristic values to imply preferred choice, this heuristic is implemented as: h(i) == 1.0 / (1.0 + distance(j, i) + mink(distance(i, k))), where h(i) is the heuristic value for city i, and j is the most recently added city.