Package org.ddolib.examples.tsptw
Record Class TSPTWState
java.lang.Object
java.lang.Record
org.ddolib.examples.tsptw.TSPTWState
- Record Components:
position- The current last position of the vehicle. Usually unique and represented byTSPNode. In merged states, the vehicle can be "at any position at the same time," represented byVirtualNodes.time- The arrival time of the vehicle at the current position.mustVisit- ABitSetrepresenting all nodes that must still be visited.possiblyVisit- ABitSetrepresenting nodes that might have been visited or not in merged states.depth- The depth of the layer containing this state in the dynamic programming model.
public record TSPTWState(org.ddolib.examples.tsptw.Position position, int time, BitSet mustVisit, BitSet possiblyVisit, int depth)
extends Record
Represents a state in the dynamic programming model for the Traveling Salesman Problem with Time Windows (TSPTW).
Each state encapsulates the current information about the vehicle's position, the set of nodes yet to visit, and timing information. This record is used both for individual states and for relaxed/merged states.
-
Constructor Summary
ConstructorsConstructorDescriptionTSPTWState(org.ddolib.examples.tsptw.Position position, int time, BitSet mustVisit, BitSet possiblyVisit, int depth) Creates an instance of aTSPTWStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionintdepth()Returns the value of thedepthrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themustVisitrecord component.org.ddolib.examples.tsptw.Positionposition()Returns the value of thepositionrecord component.Returns the value of thepossiblyVisitrecord component.inttime()Returns the value of thetimerecord component.toString()Returns a string representation of this TSPTW state, including position, time, must-visit and possibly-visit nodes, and depth.
-
Constructor Details
-
TSPTWState
public TSPTWState(org.ddolib.examples.tsptw.Position position, int time, BitSet mustVisit, BitSet possiblyVisit, int depth) Creates an instance of aTSPTWStaterecord class.- Parameters:
position- the value for thepositionrecord componenttime- the value for thetimerecord componentmustVisit- the value for themustVisitrecord componentpossiblyVisit- the value for thepossiblyVisitrecord componentdepth- the value for thedepthrecord component
-
-
Method Details
-
toString
Returns a string representation of this TSPTW state, including position, time, must-visit and possibly-visit nodes, and depth. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
position
public org.ddolib.examples.tsptw.Position position()Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
time
public int time()Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-
mustVisit
Returns the value of themustVisitrecord component.- Returns:
- the value of the
mustVisitrecord component
-
possiblyVisit
Returns the value of thepossiblyVisitrecord component.- Returns:
- the value of the
possiblyVisitrecord component
-
depth
public int depth()Returns the value of thedepthrecord component.- Returns:
- the value of the
depthrecord component
-