- java.lang.Object
-
- org.chocosolver.solver.learn.IExplanation
-
- org.chocosolver.solver.learn.ExplanationForSignedClause
-
public class ExplanationForSignedClause extends IExplanation
- Since:
- 27/01/2017.
- Author:
- Charles Prud'homme
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ASSERT_NO_LEFT_BRANCH
Set to false when skip assertion that no left branch are backtracked tostatic boolean
DEFAULT_X
Set to true to force all cause to use default explanationsstatic boolean
FINE_PROOF
FOR DEBUGGING PURPOSE ONLY.static boolean
PROOF
FOR DEBUGGING PURPOSE ONLY.
-
Constructor Summary
Constructors Constructor Description ExplanationForSignedClause(Implications ig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLiteral(IntVar var, IntIterableRangeSet dom, boolean pivot)
Add a signed literal (var ∈ dom) to this explanation.void
extractConstraint(Model mModel, ClauseStore ngstore)
Extract and post the nogood related to this explanationint
getAssertingLevel()
int
getCardinality()
IntIterableRangeSet
getComplementSet(IntVar var)
IntIterableRangeSet
getFreeSet()
Return an empty set available (created and returned) or create a new oneIntIterableRangeSet
getFreeSet(int val)
Return an available set (created and returned) or create a new one then add 'val' to it.IntIterableRangeSet
getFreeSet(int a, int b)
Return an available set (created and returned) or create a new one then add range ['a','b'] to it.ValueSortedMap<IntVar>
getFront()
HashMap<IntVar,IntIterableRangeSet>
getLiterals()
IntIterableRangeSet
getRootSet(IntVar var)
IntIterableRangeSet
getSet(int p)
IntIterableRangeSet
getSet(IntVar var)
void
learnSignedClause(ContradictionException cex)
From a given conflict, defined by cex and the current implication graph mIG, this method will compute the signed clause inferred from the conflict.void
learnSolution(DecisionPath path)
void
recycle()
Recycle this explanation when it is not used anymore.void
returnSet(IntIterableRangeSet set)
String
toString()
-
-
-
Field Detail
-
ASSERT_NO_LEFT_BRANCH
public static boolean ASSERT_NO_LEFT_BRANCH
Set to false when skip assertion that no left branch are backtracked to
-
DEFAULT_X
public static boolean DEFAULT_X
Set to true to force all cause to use default explanations
-
PROOF
public static boolean PROOF
FOR DEBUGGING PURPOSE ONLY. Set to true to output proofs
-
FINE_PROOF
public static boolean FINE_PROOF
FOR DEBUGGING PURPOSE ONLY. Set to true to output proofs with details
-
-
Constructor Detail
-
ExplanationForSignedClause
public ExplanationForSignedClause(Implications ig)
-
-
Method Detail
-
extractConstraint
public void extractConstraint(Model mModel, ClauseStore ngstore)
Description copied from class:IExplanation
Extract and post the nogood related to this explanation- Specified by:
extractConstraint
in classIExplanation
- Parameters:
mModel
- the model to post the nogood in
-
recycle
public void recycle()
Description copied from class:IExplanation
Recycle this explanation when it is not used anymore.- Specified by:
recycle
in classIExplanation
-
learnSolution
public void learnSolution(DecisionPath path)
-
learnSignedClause
public void learnSignedClause(ContradictionException cex)
From a given conflict, defined by cex and the current implication graph mIG, this method will compute the signed clause inferred from the conflict. A call toextractConstraint(Model, ClauseStore)
will return the computed result.- Parameters:
cex
- the conflict
-
addLiteral
public void addLiteral(IntVar var, IntIterableRangeSet dom, boolean pivot)
Add a signed literal (var ∈ dom) to this explanation. This is achieved in three steps:- signed binary resolution (where 'v' is the pivot variable):
(v ∈ A ∨ X), (v ∈ B ∨ Y) : (v ∈ (A∩B) ∨ X ∨ Y)
-
simplification:
(v ∈ ∅ ∨ Z) : (Z)
-
join literals:
((∀i v ∈ Ai) ∨ Z) : (v ∈ (∪i Ai) ∨ Z)
- Parameters:
var
- signed literal variabledom
- signed literal domainpivot
- true if var is the pivot variable
- signed binary resolution (where 'v' is the pivot variable):
-
getCardinality
public int getCardinality()
- Returns:
- the number of literals in this explanation
-
getAssertingLevel
public int getAssertingLevel()
- Returns:
- the decision to refute (ie, point to jump to wrt the current decision path).
-
getFreeSet
public IntIterableRangeSet getFreeSet()
Return an empty set available (created and returned) or create a new one- Returns:
- a free set
-
getFreeSet
public IntIterableRangeSet getFreeSet(int val)
Return an available set (created and returned) or create a new one then add 'val' to it.- Returns:
- a free set
-
getFreeSet
public IntIterableRangeSet getFreeSet(int a, int b)
Return an available set (created and returned) or create a new one then add range ['a','b'] to it.- Returns:
- a free set
-
returnSet
public void returnSet(IntIterableRangeSet set)
-
getSet
public IntIterableRangeSet getSet(int p)
- Parameters:
p
- position- Returns:
- a set which contains a copy of the domain of the var at position p
-
getSet
public IntIterableRangeSet getSet(IntVar var)
- Parameters:
var
- a variable- Returns:
- a set which contains a copy of the domain of var at its front position
-
getComplementSet
public IntIterableRangeSet getComplementSet(IntVar var)
- Parameters:
var
- a variable- Returns:
- a set which contains a copy of the complement domain of var at its front position wrt to its root domain
-
getRootSet
public IntIterableRangeSet getRootSet(IntVar var)
- Parameters:
var
- a variable- Returns:
- a set which contains a copy of the root domain of var
-
getFront
public ValueSortedMap<IntVar> getFront()
-
getLiterals
public HashMap<IntVar,IntIterableRangeSet> getLiterals()
-
-