public class LastConflict extends AbstractStrategy<Variable> implements IMonitorRestart, IMonitorSolution, IMonitorContradiction
Modifier and Type | Field and Description |
---|---|
protected boolean |
active
Set to true when this strategy is active
|
protected Variable[] |
conflictingVariables
Variables related to decision in conflicts
|
protected AbstractStrategy<Variable> |
mainStrategy
The main strategy declared in the solver
|
protected Model |
model
The target solver
|
protected int |
nbCV
Number of conflicts stored
|
protected Set<Variable> |
scope |
vars
Constructor and Description |
---|
LastConflict(Model model,
AbstractStrategy<Variable> mainStrategy,
int k)
Creates a last conflict heuristic
|
Modifier and Type | Method and Description |
---|---|
void |
afterRestart()
Actions to execute after restarting the search
|
void |
beforeRestart()
Actions to execute before restarting the search
|
Decision<Variable> |
getDecision()
Provides access to the current decision in the strategy.
|
boolean |
init()
Prepare
this to be used in a search loop
The initialization can detect inconsistency, in that case, it returns false |
void |
onContradiction(ContradictionException cex) |
void |
onSolution() |
computeDecision, getVariables, makeIntDecision, toString
protected Model model
protected AbstractStrategy<Variable> mainStrategy
protected boolean active
protected int nbCV
protected Variable[] conflictingVariables
public LastConflict(Model model, AbstractStrategy<Variable> mainStrategy, int k)
model
- the solver to attach this tomainStrategy
- the main strategy declaredk
- the maximum number of conflicts to storepublic boolean init()
AbstractStrategy
this
to be used in a search loop
The initialization can detect inconsistency, in that case, it returns falseinit
in class AbstractStrategy<Variable>
public Decision<Variable> getDecision()
AbstractStrategy
null
.getDecision
in class AbstractStrategy<Variable>
public void onContradiction(ContradictionException cex)
onContradiction
in interface IMonitorContradiction
public void beforeRestart()
IMonitorRestart
beforeRestart
in interface IMonitorRestart
public void afterRestart()
IMonitorRestart
afterRestart
in interface IMonitorRestart
public void onSolution()
onSolution
in interface IMonitorSolution
Copyright © 2018. All rights reserved.