Package org.ddolib.examples.tsptw
Class TSPTWDominance
java.lang.Object
org.ddolib.examples.tsptw.TSPTWDominance
- All Implemented Interfaces:
Dominance<TSPTWState>
Dominance relation for the Traveling Salesman Problem with Time Windows (TSPTW).
This class defines a dominance rule between two TSPTWState instances.
Two states are comparable if they share the same current position and the same
set of remaining locations to visit (mustVisit). Among such comparable states,
the state with the lower current time dominates the other.
Dominance is used to prune the search space: if a state is dominated by another, it can be safely discarded without losing optimality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetKey(TSPTWState state) Returns the dominance key for a given state, based on its current position and the set of locations that still must be visited.booleanisDominatedOrEqual(TSPTWState state1, TSPTWState state2) Checks whetherstate1is dominated by or equal tostate2.
-
Constructor Details
-
TSPTWDominance
public TSPTWDominance()
-
-
Method Details
-
getKey
Returns the dominance key for a given state, based on its current position and the set of locations that still must be visited.- Specified by:
getKeyin interfaceDominance<TSPTWState>- Parameters:
state- The state for which to compute the dominance key.- Returns:
- The
TSPTWDominanceKeyrepresenting the key of this state.
-
isDominatedOrEqual
Checks whetherstate1is dominated by or equal tostate2.state1is considered dominated or equal tostate2if it has the same position and mustVisit set, and its current time is greater than or equal to that ofstate2.- Specified by:
isDominatedOrEqualin interfaceDominance<TSPTWState>- Parameters:
state1- The state being tested for dominance.state2- The state to compare against.- Returns:
trueifstate1is dominated by or equal tostate2,falseotherwise.
-