choco.cp.solver.variables.real
Class RealVarImpl<C extends AbstractSConstraint & RealPropagator>

java.lang.Object
  extended by choco.kernel.solver.variables.AbstractVar
      extended by choco.cp.solver.variables.real.RealVarImpl<C>
All Implemented Interfaces:
IExtensionnable, IPretty, IIndex, RealExp, Domain, RealInterval, RealVar, Var

public final class RealVarImpl<C extends AbstractSConstraint & RealPropagator>
extends AbstractVar
implements RealVar

An implementation of real variables using RealDomain domains.


Field Summary
protected  RealDomain domain
           
 
Fields inherited from class choco.kernel.solver.variables.AbstractVar
constraints, event, extensions, name, propagationEngine
 
Fields inherited from interface choco.kernel.solver.variables.real.RealVar
BOUNDS
 
Fields inherited from interface choco.kernel.solver.variables.Var
LOGGER
 
Constructor Summary
RealVarImpl(Solver solver, String name, double a, double b, int domaintype)
           
 
Method Summary
 Set<RealVar> collectVars(Set<RealVar> s)
          Collects recursively all the variable this expression depends on.
 DisposableIterator<Couple<C>> getActiveConstraints(C cstrCause)
           
 RealDomain getDomain()
           
 double getInf()
           
 double getSup()
           
 RealInterval getValue()
           
 void intersect(RealInterval interval)
          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, List<RealExp> wx, List<RealExp> wox)
          Isolates sub terms depending or not on a variable x.
 String pretty()
          pretty printing of the object.
 void project()
          Projects computed bounds to the sub expressions.
 void silentlyAssign(RealInterval i)
          Modifies bounds silently (does not propagate modifications).
 List<RealExp> subExps(List<RealExp> l)
          Computes recursively the sub expressions (avoids to tighten and project recursively).
 void tighten()
          Computes the narrowest bounds with respect to sub terms.
 String toString()
          Useful for debugging.
 
Methods inherited from class choco.kernel.solver.variables.AbstractVar
addConstraint, addExtension, eraseConstraint, getAbstractVarExtensionNumber, getConstraint, getConstraintsIterator, getConstraintVector, getEvent, getExtension, getIndex, getIndexVector, getName, getNbConstraints, getPriority, getVarIndex, hashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.kernel.solver.variables.Var
addConstraint, getConstraint, getConstraintsIterator, getConstraintVector, getEvent, getIndexVector, getName, getNbConstraints, getPriority, getVarIndex
 
Methods inherited from interface choco.kernel.common.IIndex
getIndex
 
Methods inherited from interface choco.IExtensionnable
addExtension, getExtension
 

Field Detail

domain

protected RealDomain domain
Constructor Detail

RealVarImpl

public RealVarImpl(Solver solver,
                   String name,
                   double a,
                   double b,
                   int domaintype)
Method Detail

getActiveConstraints

public final DisposableIterator<Couple<C>> getActiveConstraints(C cstrCause)

toString

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

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

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
Returns:
a readable string representation of the object

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

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
Returns:
a boolean giving if a variable is instanciated or not

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 List<RealExp> subExps(List<RealExp> 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 Set<RealVar> collectVars(Set<RealVar> 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,
                       List<RealExp> wx,
                       List<RealExp> wox)
Description copied from interface: RealExp
Isolates sub terms depending or not on a variable x.

Specified by:
isolate in interface RealExp
Returns:
TODO


Copyright © 2012. All Rights Reserved.