- java.lang.Object
-
- org.chocosolver.solver.learn.Implications
-
- Direct Known Subclasses:
LazyImplications
public abstract class Implications extends Object
A abstract class that maintains an implication graph, built from events generated thanks to the propagation.Project: choco-solver.
- Since:
- 25/01/2017.
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description Implications()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
collectNodesFromConflict(ContradictionException conflict, ValueSortedMap<IntVar> front)
Fill set with indices of nodes that throws the conflictabstract void
copyComplementSet(IntVar var, IntIterableRangeSet set, IntIterableRangeSet dest)
Copy in dest the complement of set wrt to root domain of varabstract void
findPredecessor(ValueSortedMap<IntVar> front, IntVar vi, int p)
Find the direct predecessor of a node, declared on variable vi, starting from node at position p.abstract ICause
getCauseAt(int idx)
Get theICause
declared in node idxabstract int
getDecisionLevelAt(int idx)
Get the decision level declared in node idxabstract IntIterableRangeSet
getDomainAt(int idx)
Get theIntIterableRangeSet
that represents domain declared in node idxabstract int
getEventMaskAt(int idx)
Get the mask of event declared in node idx.abstract IntVar
getIntVarAt(int idx)
Get theIntVar
declared in node idxabstract int
getPredecessorOf(int idx)
Get the position of precedent entry of the one declared in node idxabstract IntIterableRangeSet
getRootDomain(IntVar var)
Get theIntIterableRangeSet
that represents domain of this variables as declared in the modelabstract int
getValueAt(int idx)
Get the value declared in node idxabstract void
init(Model model)
Initialize this classabstract void
predecessorsOf(int p, ValueSortedMap<IntVar> front)
Retrieve the nodes that are predecessors of node p in this and put them into set.abstract void
pushEvent(IntVar var, ICause cause, IntEventType mask, int one, int two, int three)
Push an eventabstract void
reset()
Reset the model, set at its creation state, before callinginit(Model)
.abstract int
size()
abstract void
tagDecisionLevel()
abstract void
undoLastEvent()
Undo the last event stored, use only when dealing with views.
-
-
-
Method Detail
-
init
public abstract void init(Model model)
Initialize this class- Parameters:
model
- if needed, a reference to the model that uses this class
-
reset
public abstract void reset()
Reset the model, set at its creation state, before callinginit(Model)
.
-
pushEvent
public abstract void pushEvent(IntVar var, ICause cause, IntEventType mask, int one, int two, int three)
Push an event- Parameters:
var
- modified variablecause
- cause of the modificationmask
- modification maskone
- an inttwo
- an intthree
- an int
-
size
public abstract int size()
- Returns:
- the number of nodes in the implication graph.
-
collectNodesFromConflict
public abstract void collectNodesFromConflict(ContradictionException conflict, ValueSortedMap<IntVar> front)
Fill set with indices of nodes that throws the conflict- Parameters:
conflict
- the failure, in the form of aContradictionException
front
- (initially empty) map of (node, variable) in conflict
-
predecessorsOf
public abstract void predecessorsOf(int p, ValueSortedMap<IntVar> front)
Retrieve the nodes that are predecessors of node p in this and put them into set.- Parameters:
p
- index of the node whom predecessors have to be foundfront
- map of (node, variable) in conflict
-
findPredecessor
public abstract void findPredecessor(ValueSortedMap<IntVar> front, IntVar vi, int p)
Find the direct predecessor of a node, declared on variable vi, starting from node at position p.- Parameters:
front
- the set to updatevi
- the variable to look the predecessor forp
- the rightmost position of the node (below means outdated node).
-
getCauseAt
public abstract ICause getCauseAt(int idx)
Get theICause
declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- the cause declared in node idx
-
getEventMaskAt
public abstract int getEventMaskAt(int idx)
Get the mask of event declared in node idx. The mask can be a bitwise operation over mask ofIntEventType
.- Parameters:
idx
- position of the node to query- Returns:
- the event declared in node idx
-
getIntVarAt
public abstract IntVar getIntVarAt(int idx)
Get theIntVar
declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- the intvar declared in node idx
-
getValueAt
public abstract int getValueAt(int idx)
Get the value declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- the value declared in node idx
-
getDecisionLevelAt
public abstract int getDecisionLevelAt(int idx)
Get the decision level declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- the decision level declared in node idx
-
getDomainAt
public abstract IntIterableRangeSet getDomainAt(int idx)
Get theIntIterableRangeSet
that represents domain declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- the domain declared in node idx
-
getPredecessorOf
public abstract int getPredecessorOf(int idx)
Get the position of precedent entry of the one declared in node idx- Parameters:
idx
- position of the node to query- Returns:
- its ancestor
-
getRootDomain
public abstract IntIterableRangeSet getRootDomain(IntVar var)
Get theIntIterableRangeSet
that represents domain of this variables as declared in the model- Parameters:
var
- variable to query- Returns:
- the domain declared in node idx
-
copyComplementSet
public abstract void copyComplementSet(IntVar var, IntIterableRangeSet set, IntIterableRangeSet dest)
Copy in dest the complement of set wrt to root domain of var- Parameters:
var
- variable to query
-
undoLastEvent
public abstract void undoLastEvent()
Undo the last event stored, use only when dealing with views.
-
tagDecisionLevel
public abstract void tagDecisionLevel()
-
-