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 void
afterRestart()
Actions to execute after restarting the searchvoid
beforeRestart()
Actions to execute before restarting the searchDecision<V>
getDecision()
Provides access to the current decision in the strategy.boolean
init()
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns falsevoid
onContradiction(ContradictionException cex)
void
onSolution()
void
remove()
Remove the current strategy.-
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:AbstractStrategy
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
init
in classAbstractStrategy<V extends Variable>
-
remove
public void remove()
Description copied from class:AbstractStrategy
Remove the current strategy. This implies unplugging variable or search monitors.- Overrides:
remove
in classAbstractStrategy<V extends Variable>
-
getDecision
public Decision<V> getDecision()
Description copied from class:AbstractStrategy
Provides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull
.- Specified by:
getDecision
in classAbstractStrategy<V extends Variable>
- Returns:
- the current decision
-
onContradiction
public void onContradiction(ContradictionException cex)
- Specified by:
onContradiction
in interfaceIMonitorContradiction
-
beforeRestart
public void beforeRestart()
Description copied from interface:IMonitorRestart
Actions to execute before restarting the search- Specified by:
beforeRestart
in interfaceIMonitorRestart
-
afterRestart
public void afterRestart()
Description copied from interface:IMonitorRestart
Actions to execute after restarting the search- Specified by:
afterRestart
in interfaceIMonitorRestart
-
onSolution
public void onSolution()
- Specified by:
onSolution
in interfaceIMonitorSolution
-
-