Record Class TSPTWDominanceKey

java.lang.Object
java.lang.Record
org.ddolib.examples.tsptw.TSPTWDominanceKey
Record Components:
p - The current position in the tour.
mustVisit - The set of locations that must still be visited.

public record TSPTWDominanceKey(org.ddolib.examples.tsptw.Position p, BitSet mustVisit) extends Record
Key used for dominance checking in the Traveling Salesman Problem with Time Windows (TSPTW).

A TSPTWDominanceKey uniquely identifies a group of states that share the same current position p and the same set of locations that still must be visited (mustVisit). It is used by TSPTWDominance to determine which states can be compared for dominance.

Two states with the same dominance key are comparable: the state with the lower current time dominates the other, allowing pruning in the search.

  • Constructor Summary

    Constructors
    Constructor
    Description
    TSPTWDominanceKey(org.ddolib.examples.tsptw.Position p, BitSet mustVisit)
    Creates an instance of a TSPTWDominanceKey record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the mustVisit record component.
    org.ddolib.examples.tsptw.Position
    p()
    Returns the value of the p record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TSPTWDominanceKey

      public TSPTWDominanceKey(org.ddolib.examples.tsptw.Position p, BitSet mustVisit)
      Creates an instance of a TSPTWDominanceKey record class.
      Parameters:
      p - the value for the p record component
      mustVisit - the value for the mustVisit record component
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • p

      public org.ddolib.examples.tsptw.Position p()
      Returns the value of the p record component.
      Returns:
      the value of the p record component
    • mustVisit

      public BitSet mustVisit()
      Returns the value of the mustVisit record component.
      Returns:
      the value of the mustVisit record component