Record Class OperatorSelectionContext<S extends Solution<S>>

java.lang.Object
java.lang.Record
io.github.nhtc2005.alns.selection.OperatorSelectionContext<S>
Type Parameters:
S - the solution type
Record Components:
iteration - the one-based index of the iteration being started
elapsedNanos - the elapsed search time in nanoseconds, measured at the start of the iteration
bestSolution - the best feasible solution found so far
currentSolution - the current feasible solution
randomGenerator - the random generator used by the search

public record OperatorSelectionContext<S extends Solution<S>>(long iteration, long elapsedNanos, S extends Solution<S> bestSolution, S extends Solution<S> currentSolution, RandomGenerator randomGenerator) extends Record
Provides the search state for selecting an operator pair.

Solutions are shared references, not snapshots, and must not be modified by the selector.

  • Constructor Details

    • OperatorSelectionContext

      public OperatorSelectionContext(long iteration, long elapsedNanos, S bestSolution, S currentSolution, RandomGenerator randomGenerator)
      Creates an instance of a OperatorSelectionContext record class.
      Parameters:
      iteration - the value for the iteration record component
      elapsedNanos - the value for the elapsedNanos record component
      bestSolution - the value for the bestSolution record component
      currentSolution - the value for the currentSolution record component
      randomGenerator - the value for the randomGenerator record component
  • Method Details

    • toString

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • iteration

      public long iteration()
      Returns the value of the iteration record component.
      Returns:
      the value of the iteration record component
    • elapsedNanos

      public long elapsedNanos()
      Returns the value of the elapsedNanos record component.
      Returns:
      the value of the elapsedNanos record component
    • bestSolution

      public S bestSolution()
      Returns the value of the bestSolution record component.
      Returns:
      the value of the bestSolution record component
    • currentSolution

      public S currentSolution()
      Returns the value of the currentSolution record component.
      Returns:
      the value of the currentSolution record component
    • randomGenerator

      public RandomGenerator randomGenerator()
      Returns the value of the randomGenerator record component.
      Returns:
      the value of the randomGenerator record component