choco.kernel.solver.variables.real
Class RealIntervalConstant

java.lang.Object
  extended by choco.kernel.solver.variables.real.RealIntervalConstant
All Implemented Interfaces:
IExtensionnable, IPretty, IIndex, RealExp, Domain, RealConstant, RealInterval, RealVar, Var

public class RealIntervalConstant
extends Object
implements RealConstant

A constant real interval.


Field Summary
protected  double inf
           
protected  double sup
           
 
Fields inherited from interface choco.kernel.solver.variables.real.RealVar
BOUNDS
 
Fields inherited from interface choco.kernel.solver.variables.Var
LOGGER
 
Constructor Summary
RealIntervalConstant(double inf, double sup)
           
RealIntervalConstant(RealInterval interval)
           
 
Method Summary
 int addConstraint(SConstraint c, int varIdx, boolean dynamicAddition)
          Adds a new listener for the variable, that is a constraint which should be informed as soon as the variable domain is modified.
 void addExtension(int extensionNumber)
          Adds a new extension.
 Set<RealVar> collectVars(Set<RealVar> s)
          Collects recursively all the variable this expression depends on.
 SConstraint getConstraint(int i)
          Returns the ith constraint.
 DisposableIterator<SConstraint> getConstraintsIterator()
          This methods should be used if one want to access the different constraints currently posted on this variable.
 PartiallyStoredVector<SConstraint> getConstraintVector()
          access the data structure storing constraints involving a given variable
 RealDomain getDomain()
           
 VarEvent getEvent()
          returns the object used by the propagation engine to model a propagation event associated to the variable (an update to its domain)
 Extension getExtension(int extensionNumber)
          Returns the queried extension
 long getIndex()
          Unique index (Different from hashCode, can change from one execution to another one)
 PartiallyStoredIntVector getIndexVector()
          access the data structure storing indices associated to constraints involving a given variable
 double getInf()
           
 String getName()
           
 int getNbConstraints()
          Returns the number of listeners involving the variable.
 int getPriority()
          Return the priority of this according to the related constraints (minimum over all constraints priority)
 Solver getSolver()
          Retrieves the solver of the entity
 double getSup()
           
 RealInterval getValue()
           
 int getVarIndex(int constraintIndex)
          returns the index of the variable in it i-th constraint
 int hashCode()
           
 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 setSolver(Solver solver)
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

inf

protected final double inf

sup

protected final double sup
Constructor Detail

RealIntervalConstant

public RealIntervalConstant(RealInterval interval)

RealIntervalConstant

public RealIntervalConstant(double inf,
                            double sup)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getIndex

public long getIndex()
Unique index (Different from hashCode, can change from one execution to another one)

Specified by:
getIndex in interface IIndex
Returns:
the indice of the objet

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

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

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

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

getSolver

public Solver getSolver()
Retrieves the solver of the entity


setSolver

public void setSolver(Solver solver)

getNbConstraints

public int getNbConstraints()
Returns the number of listeners involving the variable.

Specified by:
getNbConstraints in interface Var
Returns:
the numbers of listeners involving the variable

getConstraint

public SConstraint getConstraint(int i)
Returns the ith constraint. i should be more than or equal to 0, and less or equal to the number of constraint minus 1.

Specified by:
getConstraint in interface Var
Parameters:
i - number of constraint to be returned
Returns:
the ith constraint

getVarIndex

public int getVarIndex(int constraintIndex)
returns the index of the variable in it i-th constraint

Specified by:
getVarIndex in interface Var
Parameters:
constraintIndex - the index of the constraint (among all constraints linked to the variable)
Returns:
the index of the variable (0 if this is the first variable of that constraint)

getConstraintVector

public PartiallyStoredVector<SConstraint> getConstraintVector()
access the data structure storing constraints involving a given variable

Specified by:
getConstraintVector in interface Var
Returns:
the vector of constraints

getIndexVector

public PartiallyStoredIntVector getIndexVector()
access the data structure storing indices associated to constraints involving a given variable

Specified by:
getIndexVector in interface Var
Returns:
the vector of index

isInstantiated

public boolean isInstantiated()
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

addConstraint

public int addConstraint(SConstraint c,
                         int varIdx,
                         boolean dynamicAddition)
Adds a new listener for the variable, that is a constraint which should be informed as soon as the variable domain is modified. The addition can be dynamic (undone upon backtracking) or not

Specified by:
addConstraint in interface Var
Parameters:
c - the constraint to add
varIdx - index of the variable
dynamicAddition - dynamical addition or not
Returns:
the number of the listener

getEvent

public VarEvent getEvent()
returns the object used by the propagation engine to model a propagation event associated to the variable (an update to its domain)

Specified by:
getEvent in interface Var
Returns:
the propagation event

getConstraintsIterator

public DisposableIterator<SConstraint> getConstraintsIterator()
This methods should be used if one want to access the different constraints currently posted on this variable.

Indeed, since indices are not always consecutive, it is the only simple way to achieve this.

Specified by:
getConstraintsIterator in interface Var
Returns:
an iterator over all constraints involving this variable

getPriority

public int getPriority()
Description copied from interface: Var
Return the priority of this according to the related constraints (minimum over all constraints priority)

Specified by:
getPriority in interface Var
Returns:

getName

public String getName()
Specified by:
getName in interface Var

getDomain

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

silentlyAssign

public void silentlyAssign(RealInterval i)
Modifies bounds silently (does not propagate modifications). This is usefull for box cosistency.

Specified by:
silentlyAssign in interface RealVar
Parameters:
i -

getValue

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

getExtension

public Extension getExtension(int extensionNumber)
Description copied from interface: IExtensionnable
Returns the queried extension

Specified by:
getExtension in interface IExtensionnable
Parameters:
extensionNumber - should use the number returned by getAbstractSConstraintExtensionNumber
Returns:
the queried extension

addExtension

public void addExtension(int extensionNumber)
Description copied from interface: IExtensionnable
Adds a new extension.

Specified by:
addExtension in interface IExtensionnable
Parameters:
extensionNumber - should use the number returned by getAbstractSConstraintExtensionNumber


Copyright © 2012. All Rights Reserved.