choco.palm.real.constraints
Class PalmEquation

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.real.constraint.AbstractLargeRealConstraint
              extended by choco.real.constraint.Equation
                  extended by choco.palm.real.constraints.PalmEquation
All Implemented Interfaces:
Constraint, Entity, PalmVarListener, PalmRealVarListener, VarEventListener, Propagator, RealConstraint, RealListener, java.lang.Cloneable, java.util.EventListener

public class PalmEquation
extends Equation
implements RealConstraint, PalmRealVarListener

Implements a constraint based on real expression that ensures that an equality is true. It is based on revisited hull consistency and can use box consistency for some variables.


Field Summary
 
Fields inherited from class choco.real.constraint.Equation
boxConsistencyDepth, boxedVars, cste, exp, nbBoxedVars, subExps, subExpsWOX, subExpsWX
 
Fields inherited from class choco.real.constraint.AbstractLargeRealConstraint
cIndices, vars
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
PalmEquation(AbstractProblem pb, RealVar[] collectedVars, RealExp exp, RealInterval cste)
          Creates an equation with an equality wetween a real expression and the constant insterval for the provided problem.
 
Method Summary
 void awake()
          First propagation: update the explanation of the constant interval with this constarint (since now we can be sure this constraint is posted).
 void awakeOnRestoreInf(int idx)
          On lower bound restoration, make the generic propagation called.
 void awakeOnRestoreSup(int idx)
          On upper bound restoration, make the generic propagation called.
protected  void bc(RealVar var, RealExp[] wx, RealExp[] wox)
          Box consistency algorithm on one variable
 void tighten(RealExp[] exps)
           
 void updateDataStructuresOnConstraint(int idx, int select, int newValue, int oldValue)
          No synchronous event handling (void method).
 void updateDataStructuresOnRestoreConstraint(int idx, int select, int newValue, int oldValue)
          No synchronous event handling (void method).
 
Methods inherited from class choco.real.constraint.Equation
addBoxedVar, awakeOnInf, awakeOnSup, boxAllVars, clone, initEquation, isConsistent, isSatisfied, proj, propagate
 
Methods inherited from class choco.real.constraint.AbstractLargeRealConstraint
assignIndices, getConstraintIdx, getNbVars, getRealVar, getRealVarNb, getSelfIndex, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.AbstractConstraint
addListener, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, 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.real.constraint.RealConstraint
getRealVar, getRealVarNb
 
Methods inherited from interface choco.Propagator
assignIndices, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed, propagate
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.real.constraint.RealListener
awakeOnInf, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
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.real.constraint.RealListener
awakeOnInf, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Constructor Detail

PalmEquation

public PalmEquation(AbstractProblem pb,
                    RealVar[] collectedVars,
                    RealExp exp,
                    RealInterval cste)
Creates an equation with an equality wetween a real expression and the constant insterval for the provided problem. An expression instance should be associated to only one constraint.

Method Detail

awake

public void awake()
           throws ContradictionException
First propagation: update the explanation of the constant interval with this constarint (since now we can be sure this constraint is posted).

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

awakeOnRestoreInf

public void awakeOnRestoreInf(int idx)
                       throws ContradictionException
On lower bound restoration, make the generic propagation called.

Specified by:
awakeOnRestoreInf in interface PalmRealVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreSup

public void awakeOnRestoreSup(int idx)
                       throws ContradictionException
On upper bound restoration, make the generic propagation called.

Specified by:
awakeOnRestoreSup in interface PalmRealVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

bc

protected void bc(RealVar var,
                  RealExp[] wx,
                  RealExp[] wox)
           throws ContradictionException
Box consistency algorithm on one variable

Overrides:
bc in class Equation
Throws:
ContradictionException

updateDataStructuresOnConstraint

public void updateDataStructuresOnConstraint(int idx,
                                             int select,
                                             int newValue,
                                             int oldValue)
No synchronous event handling (void method).

Specified by:
updateDataStructuresOnConstraint in interface PalmVarListener
Parameters:
idx - Index of the variable.
select - Type of modification (PalmIntVar.INF, PalmIntVar.SUP, PalmIntVar.VAL).
newValue - New value (or modified value).
oldValue - Old value (or 0 if this a value removal).

updateDataStructuresOnRestoreConstraint

public void updateDataStructuresOnRestoreConstraint(int idx,
                                                    int select,
                                                    int newValue,
                                                    int oldValue)
No synchronous event handling (void method).

Specified by:
updateDataStructuresOnRestoreConstraint in interface PalmVarListener
Parameters:
idx - Index of the variable.
select - Type of modification.
newValue - New value (or modified value).
oldValue - Old value (or 0 if this a value removal).

tighten

public void tighten(RealExp[] exps)
             throws ContradictionException
Overrides:
tighten in class Equation
Throws:
ContradictionException