Class AbstractUndoMove<Solution_>

java.lang.Object
ai.timefold.solver.core.impl.heuristic.move.AbstractUndoMove<Solution_>
Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
All Implemented Interfaces:
Move<Solution_>, Move<Solution_>

@Deprecated(forRemoval=true, since="1.16.0") public abstract class AbstractUndoMove<Solution_> extends Object implements Move<Solution_>
Deprecated, for removal: This API element is subject to removal in a future version.
Undo moves are automatically generated by the solver. Implementations of this class no longer have any effect any may be removed.
Abstract superclass for Move, suggested starting point to implement undo moves.
See Also:
  • Field Details

    • parentMove

      protected final Move<Solution_> parentMove
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • AbstractUndoMove

      protected AbstractUndoMove(Move<Solution_> parentMove)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • isMoveDoable

      public final boolean isMoveDoable(ScoreDirector<Solution_> scoreDirector)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Move
      Called before a move is evaluated to decide whether the move can be done and evaluated. A Move is not doable if:
      • Either doing it would change nothing in the PlanningSolution.
      • Either it's simply not possible to do (for example due to built-in hard constraints).

      It is recommended to keep this method implementation simple: do not use it in an attempt to satisfy normal hard and soft constraints.

      Although you could also filter out non-doable moves in for example the MoveSelector or MoveListFactory, this is not needed as the Solver will do it for you.

      Specified by:
      isMoveDoable in interface Move<Solution_>
      Parameters:
      scoreDirector - the ScoreDirector not yet modified by the move.
      Returns:
      true if the move achieves a change in the solution and the move is possible to do on the solution.
    • doMoveOnly

      public final void doMoveOnly(ScoreDirector<Solution_> scoreDirector)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Move
      Does the move (which indirectly affects the ScoreDirector.getWorkingSolution()). When the working solution is modified, the ScoreDirector must be correctly notified (through ScoreDirector.beforeVariableChanged(Object, String) and ScoreDirector.afterVariableChanged(Object, String)), otherwise later calculated Scores 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:
      doMoveOnly in interface Move<Solution_>
      Parameters:
      scoreDirector - never null, the ScoreDirector that needs to get notified of the changes
    • doMoveOnGenuineVariables

      protected abstract void doMoveOnGenuineVariables(ScoreDirector<Solution_> scoreDirector)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      scoreDirector - never null
    • getPlanningEntities

      public final Collection<?> getPlanningEntities()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Move
      Returns all planning entities that this move is changing. Required for entity tabu.

      This method is only called after Move.execute(MutableSolutionView), which might affect the return values.

      Duplicate entries in the returned Collection are best avoided. The returned Collection is recommended to be in a stable order. For example, use List or LinkedHashSet, but not HashSet.

      The default implementation throws an UnsupportedOperationException, making tabu search impossible unless the move class implements this method.

      Specified by:
      getPlanningEntities in interface Move<Solution_>
      Returns:
      Each entity only once.
    • getPlanningValues

      public final Collection<?> getPlanningValues()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Move
      Returns all planning values that this move is assigning to entity variables. Required for value tabu.

      This method is only called after Move.execute(MutableSolutionView), which might affect the return values.

      Duplicate entries in the returned Collection are best avoided. The returned Collection is recommended to be in a stable order. For example, use List or LinkedHashSet, but not HashSet.

      The default implementation throws an UnsupportedOperationException, making tabu search impossible unless the move class implements this method.

      Specified by:
      getPlanningValues in interface Move<Solution_>
      Returns:
      Each value only once. May contain null.
    • getSimpleMoveTypeDescription

      public String getSimpleMoveTypeDescription()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Move
      Describes the move type for statistical purposes. For example "ChangeMove(Process.computer)".

      The format is not formalized. Never parse the String returned by this method.

      Specified by:
      getSimpleMoveTypeDescription in interface Move<Solution_>
      Returns:
      never null
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object