public class ExplanationEngine extends Object implements IExplanationEngine
Created by cprudhom on 09/12/14. Project: choco.
Constructor and Description |
---|
ExplanationEngine(Model model,
boolean partialExplanationsOn,
boolean recordCauses)
Create an explanation engine based on a rule store
|
Modifier and Type | Method and Description |
---|---|
void |
activePropagator(BoolVar var,
Propagator propagator)
Explain the activation of a propagator involved in a reified constraint
|
Explanation |
explain(ContradictionException cex)
Compute the explanation of the last event from the event store (naturally, the one that leads to a conflict),
and return the explanation of the failure, that is, the (sub-)set of decisions and propagators explaining the conflict.
|
void |
freeDecisionExplanation(Decision decision)
Free the explanation related to the decision (for efficiency purpose only)
|
Explanation |
getDecisionRefutationExplanation(Decision decision)
Get the explanation of a decision refutation
|
ArrayEventStore |
getEventStore() |
RuleStore |
getRuleStore() |
void |
instantiateTo(IntVar var,
int val,
ICause cause,
int oldLB,
int oldUB)
Explain the assignment to
val of var due to cause . |
boolean |
isSaveCauses()
Indicate whether or not the clauses are saved in Explanation
|
Explanation |
makeExplanation(boolean saveCauses) |
void |
moveDecisionRefutation(Decision decision,
int to)
Move a decision explanation from the old index to the new one.
|
void |
removeValue(IntVar var,
int val,
ICause cause)
Explain the removal of the
val from var , due to cause . |
void |
storeDecisionExplanation(Decision decision,
Explanation explanation)
Store a decision refutation, for future reasoning.
|
void |
undo()
Undo the last operation done
|
void |
updateLowerBound(IntVar var,
int value,
int old,
ICause cause)
Explain the removal of [
old ,value [ from var , due to cause . |
void |
updateUpperBound(IntVar var,
int value,
int old,
ICause cause)
Explain the removal of ]
value ,old ] from var , due to cause . |
public ExplanationEngine(Model model, boolean partialExplanationsOn, boolean recordCauses)
model
- a modelpartialExplanationsOn
- set to true to enable partial explanations, false otherwiserecordCauses
- set to true to record causes in explanations, false otherwisepublic boolean isSaveCauses()
isSaveCauses
in interface IExplanationEngine
public Explanation explain(ContradictionException cex)
explain
in interface IExplanationEngine
cex
- contradiction to explainpublic Explanation makeExplanation(boolean saveCauses)
makeExplanation
in interface IExplanationEngine
saveCauses
- set to true if causes need to be storedpublic RuleStore getRuleStore()
getRuleStore
in interface IExplanationEngine
public ArrayEventStore getEventStore()
getEventStore
in interface IExplanationEngine
public Explanation getDecisionRefutationExplanation(Decision decision)
getDecisionRefutationExplanation
in interface IExplanationEngine
decision
- a refuted decisionpublic void storeDecisionExplanation(Decision decision, Explanation explanation)
storeDecisionExplanation
in interface IExplanationEngine
decision
- refuted decisionexplanation
- the explanation of the refutationpublic void moveDecisionRefutation(Decision decision, int to)
moveDecisionRefutation
in interface IExplanationEngine
decision
- a decisionto
- the new indexpublic void freeDecisionExplanation(Decision decision)
freeDecisionExplanation
in interface IExplanationEngine
decision
- the decision which is going to be forgottenpublic void removeValue(IntVar var, int val, ICause cause)
val
from var
, due to cause
.
This is the main explanation why we create this class.
Record operations to execute for explicit call to explanation.removeValue
in interface IExplanationEngine
var
- an integer variableval
- a valuecause
- a causepublic void updateLowerBound(IntVar var, int value, int old, ICause cause)
old
,value
[ from var
, due to cause
.
Prerequisite: value
should belong to var
This is the main reason why we create this class.
Record operations to execute for explicit call to explanation.updateLowerBound
in interface IExplanationEngine
var
- an integer variablevalue
- a valuecause
- a causepublic void updateUpperBound(IntVar var, int value, int old, ICause cause)
value
,old
] from var
, due to cause
.
Prerequisite: value
should belong to var
This is the main reason why we create this class.
Record operations to execute for explicit call to explanation.updateUpperBound
in interface IExplanationEngine
var
- an integer variablevalue
- a valuecause
- a causepublic void instantiateTo(IntVar var, int val, ICause cause, int oldLB, int oldUB)
val
of var
due to cause
.
This is the main reason why we create this class.
Record operations to execute for explicit call to explanation.instantiateTo
in interface IExplanationEngine
var
- an integer variableval
- a valuecause
- a causeoldLB
- previous lboldUB
- previous ubpublic void activePropagator(BoolVar var, Propagator propagator)
activePropagator
in interface IExplanationEngine
var
- the reified variablepropagator
- the propagator to awake.public void undo()
undo
in interface IExplanationEngine
Copyright © 2018. All rights reserved.