Interface MutableSolutionView<Solution_>
- Type Parameters:
Solution_-
- All Superinterfaces:
SolutionView<Solution_>
- All Known Subinterfaces:
InnerMutableSolutionView<Solution_>
- All Known Implementing Classes:
MoveDirector
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 Summary
Modifier and TypeMethodDescription<Entity_,Value_>
voidassignValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Value_ value, Entity_ destinationEntity, int destinationIndex) Puts a given value at a particular index in a given entity'splanning list variable.<Entity_,Value_>
voidchangeVariable(PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Entity_ entity, @Nullable Value_ newValue) Reads the value of a @basic planning variableof a given entity.<Entity_,Value_>
@Nullable Value_moveValueBetweenLists(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Entity_ sourceEntity, int sourceIndex, Entity_ destinationEntity, int destinationIndex) Moves a value from one entity'splanning list variableto another.<Entity_,Value_>
@Nullable Value_moveValueInList(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Entity_ entity, int sourceIndex, int destinationIndex) Moves a value within one entity'splanning list variable.default <Entity_,Value_>
Value_unassignValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Entity_ entity, int index) Removes a value from a given entity'splanning list variableat a given index.default <Entity_,Value_>
voidunassignValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Value_ value) Removes a given value from theplanning list variablethat it's part of.<Entity_,Value_>
voidunassignValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Value_ value, Entity_ entity, int index) Removes a given value from a given entity'splanning list variableat a given index.Methods inherited from interface ai.timefold.solver.core.preview.api.move.SolutionView
getPositionOf, getValue, getValueAtIndex
-
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'splanning 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 theplanning list variablethat 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'splanning list variableat 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'splanning list variableat 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 boundsIllegalStateException- 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 variableof 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'splanning list variableto another.- Parameters:
variableMetaModel- Describes the variable to be changed.sourceEntity- The first entity whose variable value is to be changed.sourceIndex- >= 0destinationEntity- 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'splanning list variable.- Parameters:
variableMetaModel- Describes the variable to be changed.entity- The entity whose variable value is to be changed.sourceIndex- >= 0destinationIndex- >= 0- Returns:
- the value that was moved; null if nothing was moved
- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-