Class ChainedChangeMove<Solution_,Entity_>
- All Implemented Interfaces:
Move<Solution_>
-
Field Summary
Fields inherited from class ai.timefold.solver.core.impl.move.streams.generic.move.ChangeMove
entity, toPlanningValue, variableMetaModel -
Constructor Summary
ConstructorsConstructorDescriptionChainedChangeMove(PlanningVariableMetaModel<Solution_, Entity_, Entity_> variableMetaModel, Entity_ entity, Entity_ toPlanningValue, SingletonInverseVariableSupply inverseVariableSupply) -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(@NonNull MutableSolutionView<Solution_> solutionView) Runs the move and optionally records the changes done, so that they can be undone later.@NonNull ChainedChangeMove<Solution_,Entity_> Rebases a move from an originScoreDirectorto another destinationScoreDirectorwhich is usually on anotherThread.Methods inherited from class ai.timefold.solver.core.impl.move.streams.generic.move.ChangeMove
equals, extractPlanningEntities, extractPlanningValues, getVariableMetaModels, hashCode, readValue, toStringMethods inherited from class ai.timefold.solver.core.impl.move.streams.generic.move.AbstractMove
describe, getVariableDescriptor, getVariableDescriptor, getVariableDescriptor, rebaseList, rebaseSet
-
Constructor Details
-
ChainedChangeMove
public ChainedChangeMove(PlanningVariableMetaModel<Solution_, Entity_, Entity_> variableMetaModel, Entity_ entity, Entity_ toPlanningValue, SingletonInverseVariableSupply inverseVariableSupply)
-
-
Method Details
-
execute
Description copied from interface:MoveRuns the move and optionally records the changes done, so that they can be undone later.- Specified by:
executein interfaceMove<Solution_>- Overrides:
executein classChangeMove<Solution_,Entity_, Entity_> - Parameters:
solutionView- Exposes all possible mutative operations on the variables. Remembers those mutative operations and can replay them in reverse order when the solver needs to undo the move. Do not store this parameter in a field.
-
rebase
Description copied from interface:MoveRebases a move from an originScoreDirectorto another destinationScoreDirectorwhich is usually on anotherThread. It is necessary for multithreaded solving to function.The new move returned by this method translates the entities and problem facts to the destination
PlanningSolutionof the destinationScoreDirector, That destinationPlanningSolutionis a deep planning clone (or an even deeper clone) of the originPlanningSolutionthat this move has been generated from.That new move does the exact same change as this move, resulting in the same
PlanningSolutionstate, presuming that destinationPlanningSolutionwas in the same state as the originalPlanningSolutionto begin with.An implementation of this method typically iterates through every entity and fact instance in this move, translates each one to the destination
ScoreDirectorwithRebaser.rebase(Object)and creates a new move instance of the same move type, using those translated instances.The destination
PlanningSolutioncan be in a different state than the originalPlanningSolution. So, rebasing can only depend on the identity ofplanning entitiesandproblem facts, which are usually declared by aPlanningIdon those classes. It must not depend on the state of theplanning variables. One thread might rebase a move before, amid or after another thread does that same move instance.This method is thread-safe.
-