choco.integer.constraints.extension
Class AC4BinConstraint

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractBinIntConstraint
                  extended by choco.integer.constraints.extension.CspBinConstraint
                      extended by choco.integer.constraints.extension.AC4BinConstraint
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class AC4BinConstraint
extends CspBinConstraint


Field Summary
protected  int n1
           
protected  int n2
           
protected  StoredInt[] nbSupport0
           
protected  StoredInt[] nbSupport1
           
protected  int offset1
           
protected  int offset2
           
protected  StoredBitSet validSupport0
           
protected  StoredBitSet validSupport1
           
 
Fields inherited from class choco.integer.constraints.extension.CspBinConstraint
relation
 
Fields inherited from class choco.integer.constraints.AbstractBinIntConstraint
cIdx0, cIdx1, v0, v1
 
Fields inherited from class choco.integer.constraints.AbstractIntConstraint
logger
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AC4BinConstraint(IntDomainVar x0, IntDomainVar x1, BinRelation relation)
           
 
Method Summary
 void awake()
          Default initial propagation: full constraint re-propagation.
 void awakeOnInf(int idx)
          Propagation when a minimal bound of a variable was modified.
 void awakeOnInst(int idx)
          Propagation when a variable is instantiated.
 void awakeOnRem(int idx, int x)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 java.lang.Object clone()
          returns a copy of the constraint.
 void decrementNbSupportV0(int x)
          decrement the number of values b that support the assignment v1=x ie: b such that v1=x, v2=b is a feasible pair When this count reaches 0, discard the value x from the domain of v1.
 void decrementNbSupportV1(int y)
           
 java.lang.Boolean isEntailed()
          Checks if all remaining values of x are supported by all values of y.
 AbstractConstraint opposite()
          computes the constraint modelling the counter-opposite condition of this
 void propagate()
          Propagates on the constraint awake events.
 void resetNbSupport0(int x)
           
 void resetNbSupport1(int y)
           
 
Methods inherited from class choco.integer.constraints.extension.CspBinConstraint
awakeOnVar, getRelation, isSatisfied
 
Methods inherited from class choco.integer.constraints.AbstractBinIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnRemovals, getSelfIndex, isConsistent
 
Methods inherited from class choco.AbstractConstraint
addListener, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEquivalentTo, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class choco.AbstractEntity
pretty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.Propagator
constAwake, delete, getEvent, getPlugIn, getPriority
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

nbSupport0

protected StoredInt[] nbSupport0

nbSupport1

protected StoredInt[] nbSupport1

validSupport0

protected StoredBitSet validSupport0

validSupport1

protected StoredBitSet validSupport1

n1

protected int n1

n2

protected int n2

offset1

protected int offset1

offset2

protected int offset2
Constructor Detail

AC4BinConstraint

public AC4BinConstraint(IntDomainVar x0,
                        IntDomainVar x1,
                        BinRelation relation)
Method Detail

clone

public java.lang.Object clone()
Description copied from interface: Constraint
returns a copy of the constraint. This copy is a new object, may be a recursive copy in case of composite constraints. The original and the copy share the same variables & plugins

Specified by:
clone in interface Constraint
Overrides:
clone in class AbstractConstraint
Returns:

decrementNbSupportV0

public void decrementNbSupportV0(int x)
                          throws ContradictionException
decrement the number of values b that support the assignment v1=x ie: b such that v1=x, v2=b is a feasible pair When this count reaches 0, discard the value x from the domain of v1. It takes the offset into account

Throws:
ContradictionException

decrementNbSupportV1

public void decrementNbSupportV1(int y)
                          throws ContradictionException
Throws:
ContradictionException

resetNbSupport0

public void resetNbSupport0(int x)
                     throws ContradictionException
Throws:
ContradictionException

resetNbSupport1

public void resetNbSupport1(int y)
                     throws ContradictionException
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
Description copied from class: AbstractConstraint
Default initial propagation: full constraint re-propagation.

Specified by:
awake in interface Propagator
Overrides:
awake in class AbstractConstraint
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractBinIntConstraint
Propagates on the constraint awake events.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractBinIntConstraint
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int x)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on one value removal: propagation on domain revision.

Specified by:
awakeOnRem in interface IntVarEventListener
Overrides:
awakeOnRem in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Propagation when a minimal bound of a variable was modified.

Specified by:
awakeOnInf in interface IntVarEventListener
Overrides:
awakeOnInf in class AbstractIntConstraint
Parameters:
idx - The index of the variable.
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntVarEventListener
Overrides:
awakeOnSup in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Propagation when a variable is instantiated.

Specified by:
awakeOnInst in interface IntVarEventListener
Overrides:
awakeOnInst in class AbstractIntConstraint
Parameters:
idx - The index of the variable.
Throws:
ContradictionException

isEntailed

public java.lang.Boolean isEntailed()
Checks if all remaining values of x are supported by all values of y.

Specified by:
isEntailed in interface Propagator
Overrides:
isEntailed in class CspBinConstraint

opposite

public AbstractConstraint opposite()
Description copied from interface: Constraint
computes the constraint modelling the counter-opposite condition of this

Specified by:
opposite in interface Constraint
Overrides:
opposite in class AbstractConstraint
Returns:
a new constraint (modelling the opposite condition)