Class TSPTWRanking

java.lang.Object
org.ddolib.examples.tsptw.TSPTWRanking
All Implemented Interfaces:
Comparator<TSPTWState>, StateRanking<TSPTWState>

public class TSPTWRanking extends Object implements StateRanking<TSPTWState>
Ranking class for states in the Traveling Salesman Problem with Time Windows (TSPTW).

This class implements StateRanking for TSPTWState and is used to order states within the same layer of a decision diagram. The ranking helps identify which states are better candidates for merging in a relaxed decision diagram.

The comparison is based on the number of nodes in the possiblyVisit set: states with more nodes in possiblyVisit are considered better candidates for merging and are ranked higher.

  • Constructor Details

    • TSPTWRanking

      public TSPTWRanking()
  • Method Details

    • compare

      public int compare(TSPTWState o1, TSPTWState o2)
      Compares two TSPTWState objects based on the size of their possiblyVisit set.
      Specified by:
      compare in interface Comparator<TSPTWState>
      Parameters:
      o1 - the first state to compare
      o2 - the second state to compare
      Returns:
      a negative integer, zero, or a positive integer if the first state has more, equal, or fewer nodes in possiblyVisit than the second state, respectively.