choco.cp.solver.constraints.integer
Class TimesXYZ

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
          extended by choco.kernel.solver.constraints.integer.AbstractIntSConstraint
              extended by choco.kernel.solver.constraints.integer.AbstractTernIntSConstraint
                  extended by choco.cp.solver.constraints.integer.TimesXYZ
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class TimesXYZ
extends AbstractTernIntSConstraint

a constraint modelling X * Y = Z [BUG 3297805]: fix


Field Summary
 
Fields inherited from class choco.kernel.solver.constraints.integer.AbstractTernIntSConstraint
v0, v1, v2
 
Fields inherited from class choco.kernel.solver.constraints.AbstractSConstraint
cIndices, constraintType, extensions, vars
 
Fields inherited from class choco.kernel.solver.propagation.Propagator
active, constAwakeEvent, priority, propagationEngine
 
Fields inherited from interface choco.kernel.solver.constraints.SConstraint
LOGGER
 
Constructor Summary
TimesXYZ(IntDomainVar x, IntDomainVar y, IntDomainVar z)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int vIdx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
protected  void awakeOnX()
          reaction when X (v0) is updated
protected  void awakeOnY()
           
protected  void awakeOnZ()
           
 void filter(int idx)
           
 int getFilteredEventMask(int idx)
           
protected  long getXmaxIfNonZero()
           
protected  long getXminIfNonZero()
           
protected  long getYmaxIfNonZero()
           
protected  long getYminIfNonZero()
           
protected  long getZmax()
           
protected  long getZmin()
           
 Boolean isEntailed()
          Indicates if the constraint is entailed, from now on will be always satisfied
 boolean isSatisfied(int[] tuple)
          TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !
 String pretty()
          pretty printing of the object.
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void propagateZero()
          propagate the fact that v2 (Z) is instantiated to 0
protected  boolean shaveOnX()
          Updating X and Y when Z can be 0
protected  void shaveOnXandY()
           
protected  boolean shaveOnY()
           
protected  void shaveOnYandX()
           
protected  boolean updateX()
          Updating X and Y when Z cannot be 0
protected  void updateXandY()
          loop until a fix point is reach (see testProd14)
protected  boolean updateY()
           
protected  void updateYandX()
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnRem, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, opposite, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimesXYZ

public TimesXYZ(IntDomainVar x,
                IntDomainVar y,
                IntDomainVar z)
Method Detail

getFilteredEventMask

public int getFilteredEventMask(int idx)
Overrides:
getFilteredEventMask in class Propagator

isSatisfied

public boolean isSatisfied(int[] tuple)
Description copied from class: AbstractIntSConstraint
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint

pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface IPretty
Overrides:
pretty in class AbstractSConstraint<IntDomainVar>
Returns:
a readable string representation of the object

awakeOnSup

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

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnInf

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

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Throws:
ContradictionException

filter

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

awakeOnInst

public void awakeOnInst(int vIdx)
                 throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnX

protected void awakeOnX()
                 throws ContradictionException
reaction when X (v0) is updated

Throws:
ContradictionException

awakeOnY

protected void awakeOnY()
                 throws ContradictionException
Throws:
ContradictionException

awakeOnZ

protected void awakeOnZ()
                 throws ContradictionException
Throws:
ContradictionException

isEntailed

public Boolean isEntailed()
Description copied from class: AbstractSConstraint
Indicates if the constraint is entailed, from now on will be always satisfied

Overrides:
isEntailed in class AbstractSConstraint<IntDomainVar>
Returns:
wether the constraint is entailed

getXminIfNonZero

protected long getXminIfNonZero()

getXmaxIfNonZero

protected long getXmaxIfNonZero()

getYminIfNonZero

protected long getYminIfNonZero()

getYmaxIfNonZero

protected long getYmaxIfNonZero()

getZmin

protected long getZmin()

getZmax

protected long getZmax()

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Overrides:
awake in class Propagator
Throws:
ContradictionException - contradiction exception

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

propagateZero

public void propagateZero()
                   throws ContradictionException
propagate the fact that v2 (Z) is instantiated to 0

Throws:
ContradictionException

updateX

protected boolean updateX()
                   throws ContradictionException
Updating X and Y when Z cannot be 0

Throws:
ContradictionException

updateY

protected boolean updateY()
                   throws ContradictionException
Throws:
ContradictionException

updateXandY

protected void updateXandY()
                    throws ContradictionException
loop until a fix point is reach (see testProd14)

Throws:
ContradictionException

updateYandX

protected void updateYandX()
                    throws ContradictionException
Throws:
ContradictionException

shaveOnX

protected boolean shaveOnX()
                    throws ContradictionException
Updating X and Y when Z can be 0

Throws:
ContradictionException

shaveOnY

protected boolean shaveOnY()
                    throws ContradictionException
Throws:
ContradictionException

shaveOnXandY

protected void shaveOnXandY()
                     throws ContradictionException
Throws:
ContradictionException

shaveOnYandX

protected void shaveOnYandX()
                     throws ContradictionException
Throws:
ContradictionException


Copyright © 2012. All Rights Reserved.