choco.palm.integer.constraints
Class PalmElt2D

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractTernIntConstraint
                  extended by choco.palm.integer.AbstractPalmTernIntConstraint
                      extended by choco.palm.integer.constraints.PalmElt2D
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, PalmIntVarListener, PalmConstraint, PalmVarListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class PalmElt2D
extends AbstractPalmTernIntConstraint

Created by IntelliJ IDEA. User: Administrateur Date: 30 janv. 2004 Time: 11:04:19 To change this template use Options | File Templates.


Field Summary
protected  int[][] lvals
          uses the cste slot: l[i + cste] = x (ex: cste = 1 allows to use and index from 0 to length(l) - 1
 
Fields inherited from class choco.integer.constraints.AbstractTernIntConstraint
cIdx0, cIdx1, cIdx2, v0, v1, v2
 
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
PalmElt2D(IntDomainVar v0, IntDomainVar v1, IntDomainVar v2, int[][] lvals, int dim1, int dim2)
          2D Element constraint
 
Method Summary
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnRem(int idx, int val)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnRestore(int idx)
           
 void awakeOnRestoreInf(int idx)
          Handles an inf bound restoration on the constraint idx
 void awakeOnRestoreSup(int idx)
          Handles a sup bound restoration on the constraint idx
 void awakeOnRestoreVal(int idx, int val)
          Handles a val restoration on the constraint idx
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 java.lang.Object clone()
          returns a copy of the constraint.
 java.lang.Boolean isEntailed()
          Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 void propagate()
          Propagation for the constraint awake var.
 boolean testValueVarV0(int idx)
           
 boolean testValueVarV1(int idx)
           
 void updateIndexFromValue()
           
 void updateValueFromIndex()
           
 java.util.Set whyIsFalse()
          When all variables are instantiated, explains why the wonstraint is false.
 java.util.Set whyIsTrue()
          When all variables are instantiated, explains why the wonstraint is true.
 
Methods inherited from class choco.palm.integer.AbstractPalmTernIntConstraint
awakeOnInst, awakeOnRestoreVal, takeIntoAccountStatusChange, updateDataStructuresOnConstraint, updateDataStructuresOnRestoreConstraint
 
Methods inherited from class choco.integer.constraints.AbstractTernIntConstraint
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, awake, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEquivalentTo, opposite, 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.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.var.IntVarEventListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.Propagator
assignIndices, awake, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.Constraint
getConstraintIdx, getNbVars, getVar, getVarIdxInOpposite, isEquivalentTo, opposite, setConstraintIndex, setVar
 
Methods inherited from interface choco.Entity
getProblem, pretty
 
Methods inherited from interface choco.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

lvals

protected int[][] lvals
uses the cste slot: l[i + cste] = x (ex: cste = 1 allows to use and index from 0 to length(l) - 1

Constructor Detail

PalmElt2D

public PalmElt2D(IntDomainVar v0,
                 IntDomainVar v1,
                 IntDomainVar v2,
                 int[][] lvals,
                 int dim1,
                 int dim2)
2D Element constraint

Parameters:
v0 - index1
v1 - index2
v2 - valeur
lvals -
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
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:
Throws:
java.lang.CloneNotSupportedException

updateValueFromIndex

public void updateValueFromIndex()
                          throws ContradictionException
Throws:
ContradictionException

testValueVarV0

public boolean testValueVarV0(int idx)

testValueVarV1

public boolean testValueVarV1(int idx)

updateIndexFromValue

public void updateIndexFromValue()
                          throws ContradictionException
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractTernIntConstraint
Propagation for the constraint awake var.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractTernIntConstraint
Throws:
ContradictionException - if a domain becomes empty or the filtering algorithm infers a contradiction

awakeOnInf

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

Specified by:
awakeOnInf in interface IntVarEventListener
Overrides:
awakeOnInf in class AbstractIntConstraint
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

awakeOnRem

public void awakeOnRem(int idx,
                       int val)
                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

awakeOnRestore

public void awakeOnRestore(int idx)
                    throws ContradictionException
Throws:
ContradictionException

awakeOnRestoreInf

public void awakeOnRestoreInf(int idx)
                       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 AbstractPalmTernIntConstraint
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreSup

public void awakeOnRestoreSup(int idx)
                       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 AbstractPalmTernIntConstraint
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreVal

public void awakeOnRestoreVal(int idx,
                              int val)
                       throws ContradictionException
Description copied from interface: PalmIntVarListener
Handles a val restoration on the constraint idx

Parameters:
idx - Variable involved.
Throws:
ContradictionException

isEntailed

public java.lang.Boolean isEntailed()
Description copied from interface: Propagator
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.

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

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.