public class RuleStore extends Object
Created by cprudhom on 09/12/14. Project: choco.
Modifier and Type | Field and Description |
---|---|
protected static int |
BD
Mask for integer variable bounds modification
|
protected static int |
DM
Mask for integer variable modification
|
protected static int |
LB
Mask for integer variable lower bound modification
|
protected static int |
RM
Mask for integer variable value removal
|
protected static int |
UB
Mask for integer variable upper bound modification
|
Constructor and Description |
---|
RuleStore(boolean saveCauses,
boolean enablePartialExplanation)
Instantiate a rule store to compute explanations
|
Modifier and Type | Method and Description |
---|---|
boolean |
addBoundsRule(IntVar var)
Add an upper bound rule and a lower bound rule, that is, any event on the upper bound or the lower bound of the variable needs to be retained
|
boolean |
addFullDomainRule(IntVar var)
Add a full domain rule, that is, any events involving the variable needs to be retained.
|
boolean |
addLowerBoundRule(IntVar var)
Add a lower bound rule, that is, any event on the lower bound of the variable needs to be retained
|
boolean |
addPropagatorActivationRule(Propagator propagator)
Add a propagator activation rule
|
boolean |
addRemovalRule(IntVar var,
int value)
Add a value removal rule, that is, the event which remove the value needs to be retained.
|
boolean |
addUpperBoundRule(IntVar var)
Add a upper bound rule, that is, any event on the upper bound of the variable needs to be retained
|
void |
freeDecisionExplanation(Decision decision)
Free the explanation related to the decision (for efficiency purpose only)
|
Explanation |
getDecisionRefutation(Decision decision)
Get the explanation associated with a decision refutation
|
int |
getMask(Variable var)
Return the current rule mask associated to the variable vid
|
void |
init(Explanation expl)
Initialize the rulestore for a new explanation
|
boolean |
isPreemptedStop()
when conditions are favorable, a preempted stop can be considered: not all events have to be analyzed.
|
boolean |
match(int idx,
ArrayEventStore eventStore)
Return true if the event represented by matches one of the active rules.
|
boolean |
matchDomain(int ruleMask,
IntVar ivar,
IntEventType evt,
int i1,
int i2,
int i3)
Check whether a variable domain matches a rule
|
void |
moveDecisionRefutation(Decision decision,
int to)
Move a decision refutation to the 'to' index
|
void |
storeDecisionRefutation(Decision decision,
Explanation explanation)
Store a decision refutation, for future reasoning.
|
void |
update(int idx,
ArrayEventStore eventStore,
Explanation explanation)
Update the rule store, and the explanation, wrt a given event
|
protected static final int DM
protected static final int BD
protected static final int UB
protected static final int LB
protected static final int RM
public RuleStore(boolean saveCauses, boolean enablePartialExplanation)
saveCauses
- does it keep trace of the constraints in conflict ?enablePartialExplanation
- do explanations need to be complete (for DBT or nogood extraction) ?public void init(Explanation expl)
expl
- an explanationpublic boolean isPreemptedStop()
public boolean match(int idx, ArrayEventStore eventStore)
idx
- index in eventStore
of the event to evaluateeventStore
- set of eventsidx
in eventStore
matches a ruleSolverException
- when the type of the variable is neither Variable.BOOL
or Variable.INT
.public boolean matchDomain(int ruleMask, IntVar ivar, IntEventType evt, int i1, int i2, int i3)
ruleMask
- the current rule maskivar
- the integer variableevt
- the eventi1
- either instantiated value (IN) or new lb (LB) or new ub (UB) or removed value (RM)i2
- either old lb (IN, LB) or old ub (UB) or -1 (RM)i3
- either old ub (IN), or -1 (LB, UB, RM)public void update(int idx, ArrayEventStore eventStore, Explanation explanation)
idx
- index of the eventeventStore
- the event storeexplanation
- the explanation to computepublic boolean addRemovalRule(IntVar var, int value)
var
- the variable to add rule onvalue
- the removed valueSolverException
- when the domain is not enumeratedpublic boolean addFullDomainRule(IntVar var)
var
- the variable to add rule onpublic boolean addLowerBoundRule(IntVar var)
var
- the variable to add rule onpublic boolean addUpperBoundRule(IntVar var)
var
- the variable to add rule onpublic boolean addBoundsRule(IntVar var)
var
- the variable to add rule onpublic int getMask(Variable var)
var
- a variablepublic boolean addPropagatorActivationRule(Propagator propagator)
propagator
- activated propagatorpublic void storeDecisionRefutation(Decision decision, Explanation explanation)
decision
- refuted decisionexplanation
- the explanation of the refutationpublic void moveDecisionRefutation(Decision decision, int to)
decision
- a refuted decisionto
- the new indexpublic void freeDecisionExplanation(Decision decision)
decision
- the decision which is going to be forgottenpublic Explanation getDecisionRefutation(Decision decision)
decision
- a RIGHT branch decisionCopyright © 2018. All rights reserved.