Class AbstractTabuAcceptor
- java.lang.Object
-
- org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter<Solution_>
-
- org.optaplanner.core.impl.localsearch.event.LocalSearchPhaseLifecycleListenerAdapter
-
- org.optaplanner.core.impl.localsearch.decider.acceptor.AbstractAcceptor
-
- org.optaplanner.core.impl.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor
-
- All Implemented Interfaces:
EventListener,Acceptor,LocalSearchPhaseLifecycleListener,SolverLifecycleListener
- Direct Known Subclasses:
EntityTabuAcceptor,MoveTabuAcceptor,SolutionTabuAcceptor,ValueTabuAcceptor
public abstract class AbstractTabuAcceptor extends AbstractAcceptor
Abstract superclass for all Tabu Acceptors.- See Also:
Acceptor
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaspirationEnabledprotected booleanassertTabuHashCodeCorrectnessprotected TabuSizeStrategyfadingTabuSizeStrategyprotected StringlogIndentationprotected Deque<Object>tabuSequenceDequeprotected TabuSizeStrategytabuSizeStrategyprotected Map<Object,Integer>tabuToStepIndexMapprotected intworkingFadingTabuSizeprotected intworkingTabuSize-
Fields inherited from class org.optaplanner.core.impl.localsearch.decider.acceptor.AbstractAcceptor
logger
-
-
Constructor Summary
Constructors Constructor Description AbstractTabuAcceptor(String logIndentation)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadjustTabuList(int tabuStepIndex, Collection<? extends Object> tabus)protected doublecalculateFadingTabuAcceptChance(int fadingTabuStepCount)protected abstract Collection<? extends Object>findNewTabu(LocalSearchStepScope stepScope)protected abstract Collection<? extends Object>findTabu(LocalSearchMoveScope moveScope)booleanisAccepted(LocalSearchMoveScope moveScope)voidphaseEnded(LocalSearchPhaseScope phaseScope)voidphaseStarted(LocalSearchPhaseScope phaseScope)voidsetAspirationEnabled(boolean aspirationEnabled)voidsetAssertTabuHashCodeCorrectness(boolean assertTabuHashCodeCorrectness)voidsetFadingTabuSizeStrategy(TabuSizeStrategy fadingTabuSizeStrategy)voidsetTabuSizeStrategy(TabuSizeStrategy tabuSizeStrategy)voidstepEnded(LocalSearchStepScope stepScope)-
Methods inherited from class org.optaplanner.core.impl.localsearch.event.LocalSearchPhaseLifecycleListenerAdapter
stepStarted
-
Methods inherited from class org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter
solvingEnded, solvingStarted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.optaplanner.core.impl.localsearch.event.LocalSearchPhaseLifecycleListener
stepStarted
-
Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener
solvingEnded, solvingStarted
-
-
-
-
Field Detail
-
logIndentation
protected final String logIndentation
-
tabuSizeStrategy
protected TabuSizeStrategy tabuSizeStrategy
-
fadingTabuSizeStrategy
protected TabuSizeStrategy fadingTabuSizeStrategy
-
aspirationEnabled
protected boolean aspirationEnabled
-
assertTabuHashCodeCorrectness
protected boolean assertTabuHashCodeCorrectness
-
workingTabuSize
protected int workingTabuSize
-
workingFadingTabuSize
protected int workingFadingTabuSize
-
-
Constructor Detail
-
AbstractTabuAcceptor
public AbstractTabuAcceptor(String logIndentation)
-
-
Method Detail
-
setTabuSizeStrategy
public void setTabuSizeStrategy(TabuSizeStrategy tabuSizeStrategy)
-
setFadingTabuSizeStrategy
public void setFadingTabuSizeStrategy(TabuSizeStrategy fadingTabuSizeStrategy)
-
setAspirationEnabled
public void setAspirationEnabled(boolean aspirationEnabled)
-
setAssertTabuHashCodeCorrectness
public void setAssertTabuHashCodeCorrectness(boolean assertTabuHashCodeCorrectness)
-
phaseStarted
public void phaseStarted(LocalSearchPhaseScope phaseScope)
- Specified by:
phaseStartedin interfaceLocalSearchPhaseLifecycleListener- Overrides:
phaseStartedin classLocalSearchPhaseLifecycleListenerAdapter
-
phaseEnded
public void phaseEnded(LocalSearchPhaseScope phaseScope)
- Specified by:
phaseEndedin interfaceLocalSearchPhaseLifecycleListener- Overrides:
phaseEndedin classLocalSearchPhaseLifecycleListenerAdapter
-
stepEnded
public void stepEnded(LocalSearchStepScope stepScope)
- Specified by:
stepEndedin interfaceLocalSearchPhaseLifecycleListener- Overrides:
stepEndedin classLocalSearchPhaseLifecycleListenerAdapter
-
adjustTabuList
protected void adjustTabuList(int tabuStepIndex, Collection<? extends Object> tabus)
-
isAccepted
public boolean isAccepted(LocalSearchMoveScope moveScope)
- Parameters:
moveScope- not null- Returns:
- true if accepted
-
calculateFadingTabuAcceptChance
protected double calculateFadingTabuAcceptChance(int fadingTabuStepCount)
- Parameters:
fadingTabuStepCount-0 < fadingTabuStepCount <= fadingTabuSize- Returns:
0.0 < acceptChance < 1.0
-
findTabu
protected abstract Collection<? extends Object> findTabu(LocalSearchMoveScope moveScope)
-
findNewTabu
protected abstract Collection<? extends Object> findNewTabu(LocalSearchStepScope stepScope)
-
-