Class Explanation
- java.lang.Object
-
- org.chocosolver.solver.explanations.Explanation
-
public class Explanation extends Object
An explanation is simply a set of causes and decisions explaining a situation, for instance a conflict. It is related to the explanation engine (replacement of Explanation) Created by cprudhom on 09/12/14. Project: choco.- Author:
- Charles Prud'homme, Narendra Jussien
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddCause(ICause cause)Add a cause, which explains, partially, the situationvoidaddCausesAndDecisions(Explanation explanation)Merge all causes and decisions fromexplanationin this.voidaddDecision(Decision decision)Add a decision, which explains, partially, the situationvoidaddRules(Rules someRules)Merge 'someRules' into this rulesSet<ICause>getCauses()BitSetgetDecisions()intgetEvtstrIdx()Get the event store idx at which the last analysis endsRulesgetRules()Return the rules, may be nullbooleanisComplete()intnbCauses()Return the number of causes explaining the situationintnbDecisions()Return the number of decisions explaining the situationvoidrecycle()Recycle this explanation when it is not used anymore.booleanremove(ICause cause)Remove one cause from the set of causes explaining the situationvoidremove(Decision decision)Remove one decision from the set of decisions explaining the situationvoidsetEvtstrIdx(int evtstrIdx)Set the event store idx, where the last analysis endsStringtoString()
-
-
-
Method Detail
-
addCause
public boolean addCause(ICause cause)
Add a cause, which explains, partially, the situation- Parameters:
cause- a cause- Returns:
- true if this was an unknown cause
-
addDecision
public void addDecision(Decision decision)
Add a decision, which explains, partially, the situation- Parameters:
decision- a decision
-
nbCauses
public int nbCauses()
Return the number of causes explaining the situation- Returns:
- an int
-
nbDecisions
public int nbDecisions()
Return the number of decisions explaining the situation- Returns:
- an int
-
addCausesAndDecisions
public void addCausesAndDecisions(Explanation explanation)
Merge all causes and decisions fromexplanationin this.- Parameters:
explanation- a given explanation
-
addRules
public void addRules(Rules someRules)
Merge 'someRules' into this rules- Parameters:
someRules- the rules to add
-
remove
public boolean remove(ICause cause)
Remove one cause from the set of causes explaining the situation- Parameters:
cause- a cause to remove- Returns:
- true if the explanation changed
-
remove
public void remove(Decision decision)
Remove one decision from the set of decisions explaining the situation- Parameters:
decision- a decision to remove
-
getDecisions
public BitSet getDecisions()
- Returns:
- a unmodifiable copy of the set of decisions
-
isComplete
public boolean isComplete()
- Returns:
- true if the explanation is complete
-
getEvtstrIdx
public int getEvtstrIdx()
Get the event store idx at which the last analysis ends- Returns:
- an event store index
-
setEvtstrIdx
public void setEvtstrIdx(int evtstrIdx)
Set the event store idx, where the last analysis ends- Parameters:
evtstrIdx- an event store index
-
getRules
public Rules getRules()
Return the rules, may be null- Returns:
- the rules or null
-
recycle
public void recycle()
Recycle this explanation when it is not used anymore.
-
-