choco.real.var
Class RealVarImpl

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractVar
          extended by choco.real.var.RealVarImpl
All Implemented Interfaces:
Entity, RealExp, RealInterval, RealVar, Var
Direct Known Subclasses:
PalmRealVarImpl

public class RealVarImpl
extends AbstractVar
implements RealVar

An implementation of real variables using RealDomain domains.


Field Summary
protected  RealDomain domain
           
 
Fields inherited from class choco.AbstractVar
constraints, event, indices, name
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
RealVarImpl(AbstractProblem pb, java.lang.String name, double a, double b)
           
 
Method Summary
 java.util.Set collectVars(java.util.Set s)
          Collects recursively all the variable this expression depends on.
 void fail()
          a constraint may fail during propagation, raising a contradiction
 RealDomain getDomain()
           
 double getInf()
           
 double getSup()
           
 RealInterval getValue()
           
 void intersect(RealInterval interval)
          Modifies the bounds for intersecting with the specified interval.
 void intersect(RealInterval interval, int index)
          Modifies the bounds for intersecting with the specified interval.
 boolean isInstantiated()
          Public user API: Domains : testing whether a variable is instantiated or not.
 boolean isolate(RealVar var, java.util.List wx, java.util.List wox)
          Isolates sub terms depending or not on a variable x.
 void project()
          Projects computed bounds to the sub expressions.
 void silentlyAssign(RealInterval i)
          Modifies bounds silently (does not propagate modifications).
 java.util.List subExps(java.util.List l)
          Computes recursively the sub expressions (avoids to tighten and project recursively).
 void tighten()
          Computes the narrowest bounds with respect to sub terms.
 java.lang.String toString()
          Useful for debugging.
 
Methods inherited from class choco.AbstractVar
addConstraint, eraseConstraint, getConstraint, getConstraintsIterator, getConstraintVector, getEvent, getIndexVector, getNbConstraints, getVarIndex
 
Methods inherited from class choco.AbstractEntity
getProblem, pretty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.Var
addConstraint, getConstraint, getConstraintsIterator, getConstraintVector, getEvent, getIndexVector, getNbConstraints, getVarIndex
 
Methods inherited from interface choco.Entity
getProblem, pretty
 

Field Detail

domain

protected RealDomain domain
Constructor Detail

RealVarImpl

public RealVarImpl(AbstractProblem pb,
                   java.lang.String name,
                   double a,
                   double b)
Method Detail

toString

public java.lang.String toString()
Description copied from class: AbstractVar
Useful for debugging.

Overrides:
toString in class AbstractVar
Returns:
the name of the variable

getValue

public RealInterval getValue()
Specified by:
getValue in interface RealVar

getDomain

public RealDomain getDomain()
Specified by:
getDomain in interface RealVar

silentlyAssign

public void silentlyAssign(RealInterval i)
Description copied from interface: RealVar
Modifies bounds silently (does not propagate modifications). This is usefull for box cosistency.

Specified by:
silentlyAssign in interface RealVar

getInf

public double getInf()
Specified by:
getInf in interface RealInterval
Returns:
the lower bound.

getSup

public double getSup()
Specified by:
getSup in interface RealInterval
Returns:
the upper bound.

intersect

public void intersect(RealInterval interval)
               throws ContradictionException
Description copied from interface: RealInterval
Modifies the bounds for intersecting with the specified interval.

Specified by:
intersect in interface RealInterval
Throws:
ContradictionException

intersect

public void intersect(RealInterval interval,
                      int index)
               throws ContradictionException
Description copied from interface: RealInterval
Modifies the bounds for intersecting with the specified interval.

Specified by:
intersect in interface RealInterval
index - of the constraint responsible to this withdraw
Throws:
ContradictionException

fail

public void fail()
          throws ContradictionException
Description copied from interface: Var
a constraint may fail during propagation, raising a contradiction

Specified by:
fail in interface Var
Throws:
ContradictionException

isInstantiated

public boolean isInstantiated()
Description copied from interface: Var
Public user API: Domains : testing whether a variable is instantiated or not.

Specified by:
isInstantiated in interface Var

tighten

public void tighten()
Description copied from interface: RealExp
Computes the narrowest bounds with respect to sub terms.

Specified by:
tighten in interface RealExp

project

public void project()
Description copied from interface: RealExp
Projects computed bounds to the sub expressions.

Specified by:
project in interface RealExp

subExps

public java.util.List subExps(java.util.List l)
Description copied from interface: RealExp
Computes recursively the sub expressions (avoids to tighten and project recursively).

Specified by:
subExps in interface RealExp
Returns:
the flattened list of subexpressions

collectVars

public java.util.Set collectVars(java.util.Set s)
Description copied from interface: RealExp
Collects recursively all the variable this expression depends on.

Specified by:
collectVars in interface RealExp
Returns:
the collected set

isolate

public boolean isolate(RealVar var,
                       java.util.List wx,
                       java.util.List wox)
Description copied from interface: RealExp
Isolates sub terms depending or not on a variable x.

Specified by:
isolate in interface RealExp
Returns:
TODO