public class ImpactBased extends AbstractStrategy<IntVar> implements IMonitorDownBranch, IMonitorRestart, IMonitorContradiction, ICause
Modifier and Type | Field and Description |
---|---|
protected int |
aging |
protected boolean |
asgntFailed |
protected int |
currentVal |
protected int |
currentVar |
protected double[][] |
Ilabel |
protected IntVar |
lAfVar |
protected boolean |
learnsAndFails |
protected int |
nodeImpact |
protected int[] |
offsets |
protected IStateDouble |
searchSpaceSize |
protected Solver |
solver |
protected int |
split |
protected long |
timeLimit |
LOGGER, vars
Constructor and Description |
---|
ImpactBased(IntVar[] ivariables,
int alpha,
int split,
int nodeImpact,
long seed,
boolean initOnly)
Create an Impact-based search strategy with Node Impact strategy.
|
Modifier and Type | Method and Description |
---|---|
void |
afterDownLeftBranch() |
void |
afterDownRightBranch() |
void |
afterRestart() |
void |
beforeDownLeftBranch() |
void |
beforeDownRightBranch() |
void |
beforeRestart() |
Decision<IntVar> |
computeDecision(IntVar variable)
Computes a decision to be applied to variable var
This method should be implemented in order to use search patterns
|
protected double |
computeImpact(int idx)
Compute the impact of a variable
|
Decision<IntVar> |
getDecision()
Provides access to the current decision in the strategy.
|
void |
init()
Prepare
this to be used in a search loop |
void |
onContradiction(ContradictionException cex) |
protected void |
reevaluateImpact() |
protected double |
searchSpaceSize()
Compute the search space size
|
void |
setTimeLimit(long timeLimit) |
protected void |
updateImpact(double nImpact,
int varIdx,
int valIdx)
Update the impact of an assignment I(v=a)
|
boolean |
why(RuleStore ruleStore,
IntVar var,
IEventType evt,
int value)
Add new rules to the rule store
|
getVariables, toString
protected final int aging
protected double[][] Ilabel
protected int[] offsets
protected int split
protected IStateDouble searchSpaceSize
protected int currentVar
protected int currentVal
protected int nodeImpact
protected Solver solver
protected boolean asgntFailed
protected boolean learnsAndFails
protected IntVar lAfVar
protected long timeLimit
public ImpactBased(IntVar[] ivariables, int alpha, int split, int nodeImpact, long seed, boolean initOnly)
ivariables
- variables of the problem (should be integers)alpha
- aging parametersplit
- split parameter for subdomains computationnodeImpact
- force update of impacts every nodeImpact
nodes. Set value to 0 to avoid using it.seed
- a seed for randominitOnly
- only apply the initialisation phase, do not update impact thereafterpublic Decision<IntVar> computeDecision(IntVar variable)
AbstractStrategy
computeDecision
in class AbstractStrategy<IntVar>
variable
- a variablepublic Decision<IntVar> getDecision()
AbstractStrategy
null
.getDecision
in class AbstractStrategy<IntVar>
public void setTimeLimit(long timeLimit)
public void init() throws ContradictionException
AbstractStrategy
this
to be used in a search loopinit
in class AbstractStrategy<IntVar>
ContradictionException
public void beforeDownLeftBranch()
beforeDownLeftBranch
in interface IMonitorDownBranch
public void afterDownLeftBranch()
afterDownLeftBranch
in interface IMonitorDownBranch
public void beforeDownRightBranch()
beforeDownRightBranch
in interface IMonitorDownBranch
public void afterDownRightBranch()
afterDownRightBranch
in interface IMonitorDownBranch
public void onContradiction(ContradictionException cex)
onContradiction
in interface IMonitorContradiction
protected double computeImpact(int idx)
idx
- index of the variableprotected void updateImpact(double nImpact, int varIdx, int valIdx)
nImpact
- new impactvarIdx
- index of the variablevalIdx
- index of the valueprotected double searchSpaceSize()
protected void reevaluateImpact()
public void beforeRestart()
beforeRestart
in interface IMonitorRestart
public void afterRestart()
afterRestart
in interface IMonitorRestart
public boolean why(RuleStore ruleStore, IntVar var, IEventType evt, int value)
ICause
Copyright © 2015. All rights reserved.