OptaPlanner distribution 6.2.1-SNAPSHOT

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

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

public class TailChainSwapMove
extends AbstractMove

Also known as a 2-opt move.


Field Summary
protected  AnchorVariableSupply anchorVariableSupply
           
protected  SingletonInverseVariableSupply inverseVariableSupply
           
protected  Object leftEntity
           
protected  Object rightValue
           
protected  GenuineVariableDescriptor variableDescriptor
           
 
Constructor Summary
TailChainSwapMove(GenuineVariableDescriptor variableDescriptor, SingletonInverseVariableSupply inverseVariableSupply, AnchorVariableSupply anchorVariableSupply, Object leftEntity, Object rightValue)
           
 
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)
           
 Object getLeftEntity()
           
 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.
 Object getRightValue()
           
 String getSimpleMoveTypeDescription()
          Describes the move type for statistical purposes.
 int hashCode()
           
 boolean isMoveDoable(ScoreDirector scoreDirector)
          Called before a move is evaluated to decide whether the move can be done and evaluated.
protected  boolean isRightValueLaterThanLeftEntity(Object anchor)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

variableDescriptor

protected final GenuineVariableDescriptor variableDescriptor

inverseVariableSupply

protected final SingletonInverseVariableSupply inverseVariableSupply

anchorVariableSupply

protected final AnchorVariableSupply anchorVariableSupply

leftEntity

protected final Object leftEntity

rightValue

protected final Object rightValue
Constructor Detail

TailChainSwapMove

public TailChainSwapMove(GenuineVariableDescriptor variableDescriptor,
                         SingletonInverseVariableSupply inverseVariableSupply,
                         AnchorVariableSupply anchorVariableSupply,
                         Object leftEntity,
                         Object rightValue)
Method Detail

getLeftEntity

public Object getLeftEntity()

getRightValue

public Object getRightValue()

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.

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.

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.

Parameters:
scoreDirector - never null, the ScoreDirector that needs to get notified of the changes.

isRightValueLaterThanLeftEntity

protected boolean isRightValueLaterThanLeftEntity(Object anchor)

getSimpleMoveTypeDescription

public String getSimpleMoveTypeDescription()
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
Overrides:
getSimpleMoveTypeDescription in class AbstractMove
Returns:
never null

getPlanningEntities

public Collection<? extends Object> getPlanningEntities()
Description copied from interface: Move
Returns all planning entities that are being changed by this move. Required for AcceptorType.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.

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

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

OptaPlanner distribution 6.2.1-SNAPSHOT

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