Package org.ddolib.examples.tsptw
Class TSPTWRanking
java.lang.Object
org.ddolib.examples.tsptw.TSPTWRanking
- All Implemented Interfaces:
Comparator<TSPTWState>,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(TSPTWState o1, TSPTWState o2) Compares twoTSPTWStateobjects based on the size of theirpossiblyVisitset.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
TSPTWRanking
public TSPTWRanking()
-
-
Method Details
-
compare
Compares twoTSPTWStateobjects based on the size of theirpossiblyVisitset.- Specified by:
comparein interfaceComparator<TSPTWState>- Parameters:
o1- the first state to compareo2- 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
possiblyVisitthan the second state, respectively.
-