public class ImpactBased extends AbstractStrategy<IntVar> implements IMonitorDownBranch, IMonitorContradiction, ICause
vars
Constructor and Description |
---|
ImpactBased(IntVar[] vars,
boolean initOnly) |
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 |
afterDownBranch(boolean left)
Action to perform after going down in the tree search
|
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
|
Decision<IntVar> |
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 |
remove()
Remove the current strategy.
|
void |
setInitialisationTimeLimit(long timeLimit)
Define a time limit on initialisation phase.
|
void |
setReevaluationTimeLimit(long timeLimit)
Define a time limit on reevaluation phase (done every
nodeImpact nodes). |
getVariables, makeIntDecision, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
beforeDownBranch
explain, forEachIntVar
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 ImpactBased(IntVar[] vars, boolean initOnly)
public 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 setInitialisationTimeLimit(long timeLimit)
timeLimit
- in millisecondspublic void setReevaluationTimeLimit(long timeLimit)
nodeImpact
nodes).
When the limit is reached, reevaluting impacts stops and the search can go on.timeLimit
- in millisecondspublic 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<IntVar>
public void remove()
AbstractStrategy
remove
in class AbstractStrategy<IntVar>
public void onContradiction(ContradictionException cex)
onContradiction
in interface IMonitorContradiction
public void afterDownBranch(boolean left)
IMonitorDownBranch
afterDownBranch
in interface IMonitorDownBranch
left
- set to true to specify that this is a left branchCopyright © 2018. All rights reserved.