Record Class SessionContext<Solution_>

java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.score.director.SessionContext<Solution_>

@NullMarked public record SessionContext<Solution_>(Solution_ workingSolution, SolutionView<Solution_> solutionView, ValueRangeManager<Solution_> valueRangeManager, SupplyManager supplyManager) extends Record
Used throughout the solver to provide access to some internals of the score director required for initialization of Bavet nodes and other components. It is imperative that all of these values come from the same score director instance, because they are all tied to the same working solution. These values are only valid during the runtime of the session; new session requires a new SessionContext instance.
  • Constructor Details

    • SessionContext

      public SessionContext(InnerScoreDirector<Solution_,?> scoreDirector)
    • SessionContext

      public SessionContext(Solution_ workingSolution, SolutionView<Solution_> solutionView, ValueRangeManager<Solution_> valueRangeManager, SupplyManager supplyManager)
      Creates an instance of a SessionContext record class.
      Parameters:
      workingSolution - the value for the workingSolution record component
      solutionView - the value for the solutionView record component
      valueRangeManager - the value for the valueRangeManager record component
      supplyManager - the value for the supplyManager record component
  • Method Details

    • getValueRange

      public <T> CountableValueRange<T> getValueRange(ValueRangeDescriptor<Solution_> valueRangeDescriptor)
    • 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. 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.
    • workingSolution

      public Solution_ workingSolution()
      Returns the value of the workingSolution record component.
      Returns:
      the value of the workingSolution record component
    • solutionView

      public SolutionView<Solution_> solutionView()
      Returns the value of the solutionView record component.
      Returns:
      the value of the solutionView record component
    • valueRangeManager

      public ValueRangeManager<Solution_> valueRangeManager()
      Returns the value of the valueRangeManager record component.
      Returns:
      the value of the valueRangeManager record component
    • supplyManager

      public SupplyManager supplyManager()
      Returns the value of the supplyManager record component.
      Returns:
      the value of the supplyManager record component