Class LastConflict<V extends Variable>
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<V>
-
- org.chocosolver.solver.search.strategy.strategy.LastConflict<V>
-
- All Implemented Interfaces:
IMonitorContradiction,IMonitorRestart,IMonitorSolution,ISearchMonitor
public class LastConflict<V extends Variable> extends AbstractStrategy<V> implements IMonitorRestart, IMonitorSolution, IMonitorContradiction
Last Conflict heuristic Composite heuristic which hacks a mainStrategy by forcing the use of variables involved in recent conflicts- Since:
- 03/05/2013
- Author:
- Jean-Guillaume Fages, Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description LastConflict(Model model, AbstractStrategy<V> mainStrategy, int k)Creates a last conflict heuristic
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterRestart()Actions to execute after restarting the searchvoidbeforeRestart()Actions to execute before restarting the searchDecision<V>getDecision()Provides access to the current decision in the strategy.booleaninit()Preparethisto be used in a search loop The initialization can detect inconsistency, in that case, it returns falsevoidonContradiction(ContradictionException cex)voidonSolution()-
Methods inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
computeDecision, getVariables, makeIntDecision, toString
-
-
-
-
Constructor Detail
-
LastConflict
public LastConflict(Model model, AbstractStrategy<V> mainStrategy, int k)
Creates a last conflict heuristic- Parameters:
model- the solver to attach this tomainStrategy- the main strategy declaredk- the maximum number of conflicts to store
-
-
Method Detail
-
init
public boolean init()
Description copied from class:AbstractStrategyPreparethisto be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
initin classAbstractStrategy<V extends Variable>
-
getDecision
public Decision<V> getDecision()
Description copied from class:AbstractStrategyProvides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull.- Specified by:
getDecisionin classAbstractStrategy<V extends Variable>- Returns:
- the current decision
-
onContradiction
public void onContradiction(ContradictionException cex)
- Specified by:
onContradictionin interfaceIMonitorContradiction
-
beforeRestart
public void beforeRestart()
Description copied from interface:IMonitorRestartActions to execute before restarting the search- Specified by:
beforeRestartin interfaceIMonitorRestart
-
afterRestart
public void afterRestart()
Description copied from interface:IMonitorRestartActions to execute after restarting the search- Specified by:
afterRestartin interfaceIMonitorRestart
-
onSolution
public void onSolution()
- Specified by:
onSolutionin interfaceIMonitorSolution
-
-