choco.palm.search
Class NogoodConstraint
java.lang.Object
choco.AbstractEntity
choco.AbstractConstraint
choco.integer.constraints.AbstractIntConstraint
choco.integer.constraints.AbstractLargeIntConstraint
choco.palm.integer.AbstractPalmLargeIntConstraint
choco.palm.search.NogoodConstraint
- All Implemented Interfaces:
- Constraint, Entity, IntConstraint, IntVarEventListener, PalmIntVarListener, PalmConstraint, PalmVarListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
public class NogoodConstraint
- extends AbstractPalmLargeIntConstraint
Field Summary |
protected java.util.LinkedList |
nogoods
The list of nogood. |
protected java.util.LinkedList |
permanentMemory
|
Methods inherited from class choco.AbstractConstraint |
addListener, awake, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface choco.Propagator |
assignIndices, awake, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed |
nogoods
protected java.util.LinkedList nogoods
- The list of nogood. A nogood is stored as a set of decision constraints.
permanentMemory
protected java.util.LinkedList permanentMemory
NogoodConstraint
public NogoodConstraint(IntDomainVar[] vs)
getMemory
public java.util.LinkedList getMemory()
getPermanentMemorySize
public int getPermanentMemorySize()
addPermanentNogood
public void addPermanentNogood(ConstraintCollection exp)
addPermanentNogood
public void addPermanentNogood(SymbolicDecision[] exp)
addNogoodFirst
public void addNogoodFirst(ConstraintCollection exp)
addFirst
public void addFirst(PalmExplanation exp,
java.util.LinkedList mem)
removeNogood
public void removeNogood(ConstraintCollection exp)
removeLastNogood
public void removeLastNogood()
propagate
public void propagate()
throws ContradictionException
- Description copied from class:
AbstractLargeIntConstraint
- Propagates the constraint awake events.
- Specified by:
propagate
in interface Propagator
- Overrides:
propagate
in class AbstractLargeIntConstraint
- Throws:
ContradictionException
filter
public void filter()
throws ContradictionException
- Throws:
ContradictionException
filterMem
public void filterMem(java.util.LinkedList memoryToFilter)
throws ContradictionException
- Throws:
ContradictionException
filterLastDecision
public void filterLastDecision(SymbolicDecision[] nogood,
int numDec)
throws ContradictionException
- Throws:
ContradictionException
awakeOnRestoreVal
public void awakeOnRestoreVal(int idx,
int i)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles a val restoration on the constraint
idx
- Parameters:
idx
- Variable involved.
- Throws:
ContradictionException
awakeOnRestoreSup
public void awakeOnRestoreSup(int index)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles a sup bound restoration on the constraint
idx
- Specified by:
awakeOnRestoreSup
in interface PalmIntVarListener
- Overrides:
awakeOnRestoreSup
in class AbstractPalmLargeIntConstraint
- Parameters:
index
- Variable involved.
- Throws:
ContradictionException
awakeOnRestoreInf
public void awakeOnRestoreInf(int index)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles an inf bound restoration on the constraint
idx
- Specified by:
awakeOnRestoreInf
in interface PalmIntVarListener
- Overrides:
awakeOnRestoreInf
in class AbstractPalmLargeIntConstraint
- Parameters:
index
- Variable involved.
- Throws:
ContradictionException
awakeOnRemovals
public void awakeOnRemovals(int idx,
IntIterator deltaDomain)
throws ContradictionException
- Description copied from class:
AbstractIntConstraint
- The default implementation of propagation when a variable has been modified
consists in iterating all values that have been removed (the delta domain)
and propagate them one after another, incrementally.
- Specified by:
awakeOnRemovals
in interface IntConstraint
- Overrides:
awakeOnRemovals
in class AbstractIntConstraint
- Throws:
ContradictionException
awakeOnBounds
public void awakeOnBounds(int varIndex)
throws ContradictionException
- Specified by:
awakeOnBounds
in interface IntConstraint
- Overrides:
awakeOnBounds
in class AbstractIntConstraint
- Throws:
ContradictionException
isSatisfied
public boolean isSatisfied()
- Description copied from interface:
Constraint
- Semantic:
Testing if the constraint is satisfied.
Note that all variables involved in the constraint must be
instantiated when this method is called.
whyIsTrue
public java.util.Set whyIsTrue()
- Description copied from interface:
PalmIntVarListener
- When all variables are instantiated, explains why the wonstraint is true.
- Returns:
- A set of constraint justifying that the constraint is satisfied.
whyIsFalse
public java.util.Set whyIsFalse()
- Description copied from interface:
PalmIntVarListener
- When all variables are instantiated, explains why the wonstraint is false.
- Returns:
- A set of constraint justifying that the constraint is not satisfied.
checkAddition
public boolean checkAddition(SymbolicDecision[] cut1,
java.util.LinkedList memo)
checkCut
public int checkCut(SymbolicDecision[] cut1,
SymbolicDecision[] cut2)
- check whether cut1 contains cut2 or cut2 contains cut1
- Returns:
- 1 if cut1 contains cut2
2 if cut2 contains cut1
0 if cut1 is equal to cut2
-1 otherwise