public class RuleStore extends Object
Created by cprudhom on 09/12/14. Project: choco.
Constructor and Description |
---|
RuleStore(Solver solver,
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.
|
void |
addRules(Rules someRules)
Update the current rules with the one in 'rules'
|
boolean |
addUpperBoundRule(IntVar var)
Add a upper bound rule, that is, any event on the upper bound of the variable needs to be retained
|
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
|
Rules |
getRules()
Return the current rules, for copy only.
|
void |
init()
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,
IEventStore 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 |
setRules(Rules someRules)
Replace the rules by a new one.
|
void |
storeDecisionRefutation(Decision decision,
Explanation explanation)
Store a decision refutation, for future reasoning.
|
void |
update(int idx,
IEventStore eventStore,
Explanation explanation)
Update the rule store, and the explanation, wrt a given event
|
public RuleStore(Solver solver, boolean saveCauses, boolean enablePartialExplanation)
solver
- the solver to observesaveCauses
- does it keep trace of the constraints in conflict ?enablePartialExplanation
- do explanations need to be complete (for DBT or nogood extraction) ?public void init()
public boolean isPreemptedStop()
public boolean match(int idx, IEventStore eventStore)
idx
- index in eventStore
of the event to evaluateeventStore
- set of eventsSolverException
- 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, IEventStore eventStore, Explanation explanation)
idx
- index of the eventeventStore
- the event storeexplanation
- the explanation to computepublic void addRules(Rules someRules)
someRules
- some rulespublic Rules getRules()
public void setRules(Rules someRules)
public 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 Explanation getDecisionRefutation(Decision decision)
decision
- a RIGHT branch decisionCopyright © 2015. All rights reserved.