OptaPlanner core 6.0.0.Beta3

org.optaplanner.core.impl.heuristic.selector.move.generic.chained
Class ChainedChangeMove

java.lang.Object
  extended by org.optaplanner.core.impl.heuristic.selector.move.generic.ChangeMove
      extended by org.optaplanner.core.impl.heuristic.selector.move.generic.chained.ChainedChangeMove
All Implemented Interfaces:
Move

public class ChainedChangeMove
extends ChangeMove


Field Summary
 
Fields inherited from class org.optaplanner.core.impl.heuristic.selector.move.generic.ChangeMove
entity, toPlanningValue, variableDescriptor
 
Constructor Summary
ChainedChangeMove(Object entity, PlanningVariableDescriptor variableDescriptor, Object toPlanningValue)
           
 
Method Summary
 Move createUndoMove(ScoreDirector scoreDirector)
          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.
 void doMove(ScoreDirector scoreDirector)
          Does the Move and updates the Solution and its ScoreDirector accordingly.
 boolean isMoveDoable(ScoreDirector scoreDirector)
          Called before a move is evaluated to decide whether the move can be done and evaluated.
 
Methods inherited from class org.optaplanner.core.impl.heuristic.selector.move.generic.ChangeMove
equals, getEntity, getPlanningEntities, getPlanningValues, getToPlanningValue, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChainedChangeMove

public ChainedChangeMove(Object entity,
                         PlanningVariableDescriptor variableDescriptor,
                         Object toPlanningValue)
Method Detail

isMoveDoable

public boolean isMoveDoable(ScoreDirector scoreDirector)
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:

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
Overrides:
isMoveDoable in class ChangeMove
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.

createUndoMove

public Move createUndoMove(ScoreDirector scoreDirector)
Description copied from interface: Move
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.

Specified by:
createUndoMove in interface Move
Overrides:
createUndoMove in class ChangeMove
Parameters:
scoreDirector - the ScoreDirector not yet modified by the move.
Returns:
an undoMove which does the exact opposite of this move.

doMove

public void doMove(ScoreDirector scoreDirector)
Description copied from interface: Move
Does the Move and updates the Solution and its ScoreDirector accordingly. When the Solution is modified, the ScoreDirector should be correctly notified, otherwise later calculated Scores can be corrupted.

Specified by:
doMove in interface Move
Overrides:
doMove in class ChangeMove
Parameters:
scoreDirector - never null, the ScoreDirector that needs to get notified of the changes.

OptaPlanner core 6.0.0.Beta3

Copyright © 2006-2013 JBoss by Red Hat. All Rights Reserved.