Interface MutableSolutionView<Solution_>

Type Parameters:
Solution_ -
All Superinterfaces:
SolutionView<Solution_>
All Known Subinterfaces:
InnerMutableSolutionView<Solution_>
All Known Implementing Classes:
MoveDirector

@NullMarked public interface MutableSolutionView<Solution_> extends SolutionView<Solution_>
Contains all reading and mutating methods available to a Move in order to change the state of a planning solution.

This package and all of its contents are part of the Move Streams API, which is under development and is only offered as a preview feature. There are no guarantees for backward compatibility; any class, method, or field may change or be removed without prior notice, although we will strive to avoid this as much as possible.

We encourage you to try the API and give us feedback on your experience with it, before we finalize the API. Please direct your feedback to Timefold Solver Github.

  • Method Details

    • assignValue

      <Entity_, Value_> void assignValue(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Value_ value, Entity_ destinationEntity, int destinationIndex)
      Puts a given value at a particular index in a given entity's planning list variable. Moves all values at or after the index to the right.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      value - The value to be assigned to a list variable.
      destinationEntity - The entity whose list variable is to be changed.
      destinationIndex - The index at which the value is to be assigned.
    • unassignValue

      default <Entity_, Value_> void unassignValue(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Value_ value)
      Removes a given value from the planning list variable that it's part of. Shifts any later values to the left.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      value - The value to be removed from a list variable.
      Throws:
      IllegalStateException - if the value is not assigned to a list variable
    • unassignValue

      default <Entity_, Value_> Value_ unassignValue(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Entity_ entity, int index)
      Removes a value from a given entity's planning list variable at a given index. Shifts any later values to the left.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      entity - The entity whose element is to be removed from a list variable.
      index - >= 0
      Returns:
      the removed value
      Throws:
      IllegalArgumentException - if the index is out of bounds
    • unassignValue

      <Entity_, Value_> void unassignValue(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Value_ value, Entity_ entity, int index)
      Removes a given value from a given entity's planning list variable at a given index. Shifts any later values to the left.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      value - The value to be unassigned from a list variable.
      entity - The entity whose value is to be unassigned from a list variable.
      index - >= 0
      Throws:
      IllegalArgumentException - if the index is out of bounds
      IllegalStateException - if the actual value at the given index is not the given value
    • changeVariable

      <Entity_, Value_> void changeVariable(PlanningVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Entity_ entity, @Nullable Value_ newValue)
      Reads the value of a @basic planning variable of a given entity.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      entity - The entity whose variable value is to be changed.
      newValue - maybe null, if unassigning the variable
    • moveValueBetweenLists

      <Entity_, Value_> @Nullable Value_ moveValueBetweenLists(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Entity_ sourceEntity, int sourceIndex, Entity_ destinationEntity, int destinationIndex)
      Moves a value from one entity's planning list variable to another.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      sourceEntity - The first entity whose variable value is to be changed.
      sourceIndex - >= 0
      destinationEntity - The second entity whose variable value is to be changed.
      destinationIndex - >= 0
      Returns:
      the value that was moved; null if nothing was moved
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds
    • moveValueInList

      <Entity_, Value_> @Nullable Value_ moveValueInList(PlanningListVariableMetaModel<Solution_,Entity_,Value_> variableMetaModel, Entity_ entity, int sourceIndex, int destinationIndex)
      Moves a value within one entity's planning list variable.
      Parameters:
      variableMetaModel - Describes the variable to be changed.
      entity - The entity whose variable value is to be changed.
      sourceIndex - >= 0
      destinationIndex - >= 0
      Returns:
      the value that was moved; null if nothing was moved
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds