choco.palm.real.constraints
Class PalmEquation
java.lang.Object
choco.AbstractEntity
choco.AbstractConstraint
choco.real.constraint.AbstractLargeRealConstraint
choco.real.constraint.Equation
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.
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.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 java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface choco.Propagator |
assignIndices, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed, propagate |
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.
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