Class AbstractMove<Solution_>
java.lang.Object
ai.timefold.solver.core.impl.heuristic.move.AbstractMove<Solution_>
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation
- Direct Known Subclasses:
ChangeMove,CompositeMove,KOptListMove,KOptMove,ListAssignMove,ListChangeMove,ListRuinRecreateMove,ListSwapMove,ListUnassignMove,NoChangeMove,PillarChangeMove,PillarSwapMove,RuinRecreateMove,SubChainChangeMove,SubChainReversingChangeMove,SubChainReversingSwapMove,SubChainSwapMove,SubListChangeMove,SubListSwapMove,SubListUnassignMove,SwapMove,TailChainSwapMove,TwoOptListMove
Abstract superclass for
Move, requiring implementation of undo moves.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUndoMove(ScoreDirector<Solution_> scoreDirector) Deprecated, for removal: This API element is subject to removal in a future version.The solver automatically generates undo moves, this method is no longer used.final Stringdescribe()Do not override this default implementation.protected abstract voiddoMoveOnGenuineVariables(ScoreDirector<Solution_> scoreDirector) LikedoMoveOnly(ScoreDirector)but without theScoreDirector.triggerVariableListeners()call (becausedoMoveOnly(ScoreDirector)already does that).final voiddoMoveOnly(ScoreDirector<Solution_> scoreDirector) Does the move (which indirectly affects theScoreDirector.getWorkingSolution()).final voidexecute(MutableSolutionView<Solution_> solutionView) Do not override this default implementation.protected <Value_> ValueRange<Value_>extractValueRangeFromEntity(ScoreDirector<Solution_> scoreDirector, ValueRangeDescriptor<Solution_> valueRangeDescriptor, Object entity) Do not override this default implementation.static <E> List<E>rebaseList(List<E> externalObjectList, ScoreDirector<?> destinationScoreDirector) static <E> Set<E>rebaseSet(Set<E> externalObjectSet, ScoreDirector<?> destinationScoreDirector) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.timefold.solver.core.impl.heuristic.move.Move
doMove, getSimpleMoveTypeDescription, isMoveDoable, rebaseMethods inherited from interface ai.timefold.solver.core.preview.api.move.Move
getPlanningEntities, getPlanningValues
-
Constructor Details
-
AbstractMove
public AbstractMove()
-
-
Method Details
-
doMoveOnly
Description copied from interface:MoveDoes the move (which indirectly affects theScoreDirector.getWorkingSolution()). When theworking solutionis modified, theScoreDirectormust be correctly notified (throughScoreDirector.beforeVariableChanged(Object, String)andScoreDirector.afterVariableChanged(Object, String)), otherwise later calculatedScores will be corrupted, or the move may not be correctly undone.This method must end with calling
ScoreDirector.triggerVariableListeners()to ensure all shadow variables are updated.- Specified by:
doMoveOnlyin interfaceMove<Solution_>- Parameters:
scoreDirector- never null, theScoreDirectorthat needs to get notified of the changes
-
createUndoMove
@Deprecated(forRemoval=true, since="1.16.0") protected Move<Solution_> createUndoMove(ScoreDirector<Solution_> scoreDirector) Deprecated, for removal: This API element is subject to removal in a future version.The solver automatically generates undo moves, this method is no longer used.Called before the move is done, so the move can be evaluated and then be undone without resulting into a permanent change in the solution.- Parameters:
scoreDirector- theScoreDirectornot yet modified by the move.- Returns:
- an undoMove which does the exact opposite of this move.
-
doMoveOnGenuineVariables
LikedoMoveOnly(ScoreDirector)but without theScoreDirector.triggerVariableListeners()call (becausedoMoveOnly(ScoreDirector)already does that).- Parameters:
scoreDirector- never null
-
extractValueRangeFromEntity
protected <Value_> ValueRange<Value_> extractValueRangeFromEntity(ScoreDirector<Solution_> scoreDirector, ValueRangeDescriptor<Solution_> valueRangeDescriptor, Object entity) -
rebaseList
public static <E> List<E> rebaseList(List<E> externalObjectList, ScoreDirector<?> destinationScoreDirector) -
rebaseSet
public static <E> Set<E> rebaseSet(Set<E> externalObjectSet, ScoreDirector<?> destinationScoreDirector) -
execute
Description copied from interface:MoveDo not override this default implementation.- Specified by:
executein interfaceMove<Solution_>- Specified by:
executein interfaceMove<Solution_>- 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:MoveDo not override this default implementation. -
describe
Description copied from interface:MoveDo not override this default implementation.
-