org.drools.planner.core.heuristic.selector.move.generic
Class PillarSwapMove

java.lang.Object
  extended by org.drools.planner.core.heuristic.selector.move.generic.PillarSwapMove
All Implemented Interfaces:
Move

public class PillarSwapMove
extends Object
implements Move

Non-cacheable


Constructor Summary
PillarSwapMove(Collection<PlanningVariableDescriptor> variableDescriptors, List<Object> leftEntityList, List<Object> rightEntityList)
           
 
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 equals(Object o)
           
 List<Object> getLeftEntityList()
           
 Collection<? extends Object> getPlanningEntities()
          Returns all planning entities that are being changed by this move.
 Collection<? extends Object> getPlanningValues()
          Returns all planning values that entities are being assigned to by this move.
 List<Object> getRightEntityList()
           
 int hashCode()
           
 boolean isMoveDoable(ScoreDirector scoreDirector)
          Called before a move is evaluated to decide whether the move can be done and evaluated.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PillarSwapMove

public PillarSwapMove(Collection<PlanningVariableDescriptor> variableDescriptors,
                      List<Object> leftEntityList,
                      List<Object> rightEntityList)
Method Detail

getLeftEntityList

public List<Object> getLeftEntityList()

getRightEntityList

public List<Object> getRightEntityList()

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
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
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
Parameters:
scoreDirector - never null, the ScoreDirector that needs to get notified of the changes.

getPlanningEntities

public Collection<? extends Object> getPlanningEntities()
Description copied from interface: Move
Returns all planning entities that are being changed by this move. Required for AcceptorConfig.AcceptorType#PLANNING_ENTITY_TABU.

Duplicates 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.

Specified by:
getPlanningEntities in interface Move
Returns:
never null

getPlanningValues

public Collection<? extends Object> getPlanningValues()
Description copied from interface: Move
Returns all planning values that entities are being assigned to by this move. Required for AcceptorConfig.AcceptorType#PLANNING_VALUE_TABU.

Duplicates 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.

Specified by:
getPlanningValues in interface Move
Returns:
never null

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.