Class MoveDirector<Solution_>
java.lang.Object
ai.timefold.solver.core.impl.move.director.MoveDirector<Solution_>
- All Implemented Interfaces:
InnerMutableSolutionView<Solution_>,MutableSolutionView<Solution_>,Rebaser,SolutionView<Solution_>
- Direct Known Subclasses:
EphemeralMoveDirector
public sealed class MoveDirector<Solution_>
extends Object
implements InnerMutableSolutionView<Solution_>, Rebaser
permits EphemeralMoveDirector<Solution_>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <Entity_,Value_>
voidchangeVariable(@NonNull PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, Value_ newValue) Reads the value of a @basic planning variableof a given entity.Moves that are to be undone later need to be run with the instance returned by this method.<Entity_,Value_>
@NonNull ElementLocationgetPositionOf(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Value_ value) Locates a given value in any @list planning variable.protected static <Solution_,Entity_, Value_>
ElementLocationgetPositionOf(InnerScoreDirector<Solution_, ?> scoreDirector, PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Value_ value) final <Entity_,Value_>
Value_getValue(@NonNull PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity) Reads the value of a @basic planning variableof a given entity.final <Entity_,Value_>
Value_getValueAtIndex(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, int index) Reads the value of a @list planning variableof a given entity at a specific index.final <Entity_,Value_>
voidmoveValueBetweenLists(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ sourceEntity, int sourceIndex, @NonNull Entity_ destinationEntity, int destinationIndex) Moves a value from one entity'splanning list variableto another.final <Entity_,Value_>
voidmoveValueInList(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, int sourceIndex, int destinationIndex) Moves a value within one entity'splanning list variable.final <T> Trebase(@NonNull T problemFactOrPlanningEntity) Translates an entity or fact instance (often from anotherThread) to anotherScoreDirector's internal working instance.final voidTells the underlyingScoreDirectorto notify the solver of the mutating operations performed by theMove.
-
Field Details
-
scoreDirector
-
-
Constructor Details
-
MoveDirector
-
-
Method Details
-
changeVariable
public final <Entity_,Value_> void changeVariable(@NonNull PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, Value_ newValue) Description copied from interface:MutableSolutionViewReads the value of a @basic planning variableof a given entity.- Specified by:
changeVariablein interfaceMutableSolutionView<Solution_>- 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
public final <Entity_,Value_> void moveValueBetweenLists(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ sourceEntity, int sourceIndex, @NonNull Entity_ destinationEntity, int destinationIndex) Description copied from interface:MutableSolutionViewMoves a value from one entity'splanning list variableto another.- Specified by:
moveValueBetweenListsin interfaceMutableSolutionView<Solution_>- 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
-
moveValueInList
public final <Entity_,Value_> void moveValueInList(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, int sourceIndex, int destinationIndex) Description copied from interface:MutableSolutionViewMoves a value within one entity'splanning list variable.- Specified by:
moveValueInListin interfaceMutableSolutionView<Solution_>- Parameters:
variableMetaModel- Describes the variable to be changed.entity- The entity whose variable value is to be changed.sourceIndex- >= 0destinationIndex- >= 0
-
updateShadowVariables
public final void updateShadowVariables()Description copied from interface:MutableSolutionViewTells the underlyingScoreDirectorto notify the solver of the mutating operations performed by theMove.- Specified by:
updateShadowVariablesin interfaceMutableSolutionView<Solution_>
-
getValue
public final <Entity_,Value_> Value_ getValue(@NonNull PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity) Description copied from interface:SolutionViewReads the value of a @basic planning variableof a given entity.- Specified by:
getValuein interfaceSolutionView<Solution_>- Parameters:
variableMetaModel- Describes the variable whose value is to be read.entity- The entity whose variable is to be read.- Returns:
- The value of the variable on the entity.
-
getValueAtIndex
public final <Entity_,Value_> Value_ getValueAtIndex(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Entity_ entity, int index) Description copied from interface:SolutionViewReads the value of a @list planning variableof a given entity at a specific index.- Specified by:
getValueAtIndexin interfaceSolutionView<Solution_>- Parameters:
variableMetaModel- Describes the variable whose value is to be read.entity- The entity whose variable is to be read.index- >= 0- Returns:
- maybe null; the value of the variable on the entity at the index
-
getPositionOf
public <Entity_,Value_> @NonNull ElementLocation getPositionOf(@NonNull PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, @NonNull Value_ value) Description copied from interface:SolutionViewLocates a given value in any @list planning variable.- Specified by:
getPositionOfin interfaceSolutionView<Solution_>- Parameters:
variableMetaModel- Describes the variable whose value is to be read.value- The value to locate.- Returns:
- never null; the location of the value in the variable
-
getPositionOf
protected static <Solution_,Entity_, ElementLocation getPositionOfValue_> (InnerScoreDirector<Solution_, ?> scoreDirector, PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel, Value_ value) -
rebase
public final <T> T rebase(@NonNull T problemFactOrPlanningEntity) Description copied from interface:RebaserTranslates an entity or fact instance (often from anotherThread) to anotherScoreDirector's internal working instance. Useful for move rebasing and in aProblemChangeand for multi-threaded solving.Matching is determined by the
LookUpStrategyTypeonPlanningSolution. Matching uses aPlanningIdby default. -
ephemeral
Moves that are to be undone later need to be run with the instance returned by this method.- Returns:
- never null
-
getScoreDirector
- Specified by:
getScoreDirectorin interfaceInnerMutableSolutionView<Solution_>
-