choco.integer
Interface IntDomainVar

All Superinterfaces:
Entity, IntExp, IntVar, Var
All Known Subinterfaces:
ExplainedIntVar
All Known Implementing Classes:
IntDomainVarImpl, JumpIntVar, PalmIntVar

public interface IntDomainVar
extends IntVar

An interface for all implementations of search valued domain variables


Field Summary
static int BOUNDS
          Public user API: static constants associated to the encoding of the variable domain these constants are passed as parameters to the constructor of IntVars BOUNDS = an interval (keeping the lower and upper bounds)
static int LIST
          Public user API: static constants associated to the encoding of the variable domain these constants are passed as parameters to the constructor of IntVars LIST = a chained list of values
 
Method Summary
 boolean canBeEqualTo(IntDomainVar x)
          Public user API: Domains : testing whether two variables have intersecting domains.
 boolean canBeInstantiatedIn(int[] sortedValList, int nVals)
          Public user API: Domains : testing whether one value among a list is present in the domain.
 boolean canBeInstantiatedTo(int x)
          Public user API: Domains : testing whether a value is in the domain.
 IntDomain getDomain()
          Public user API: Domains : returns the object responsible for storing the enumeration of values in the domain
 int getDomainSize()
          Public user API: Domains : retrieves the number of values in the domain.
 int getInf()
          Returns the lower bound of the variable domain (e.g. the smallest value that the variable can be assigned).
 int getNextDomainValue(int i)
          Public user API: Domains : retrieves the value immediately (but strictly) after i in the domain
 int getPrevDomainValue(int i)
          Public user API: Domains : retrieves the value immediately (but strictly) before i in the domain.
 AbstractProblem getProblem()
          Public user API: Util : retrieves the problem to which the variable belongs.
 int getRandomDomainValue()
          Public user API: Domains : retrieves a value drawn at random (uniform distribution) from the domain.
 int getSup()
          Returns the upper bound of the variable domain (e.g. the greatest value that the variable can be assigned).
 int getVal()
          Returns the value of the variable if instantiated.
 int getValue()
          Deprecated. replaced by getVal
 boolean hasEnumeratedDomain()
          Public user API: Domains : whether an enumeration of values (in addition to the enclosing interval) is stored
 boolean instantiate(int x, int idx)
          Propagation events instantiating a variable (ie: removing all other values from the domain)
 boolean isInstantiatedTo(int x)
          Public user API: Domains : testing whether the value of an instantiated variable is equal to a specific value.
 boolean removeInterval(int a, int b, int idx)
          Propagation events updating the domain of a variable (by removing an interval, ie, a sequence of consecutive values)
 boolean removeVal(int x, int idx)
          Propagation events updating the domain of a variable (by removing a value)
 void remVal(int x)
          Public user API: Propagation events removing a value from the domain of a variable.
 void setInf(int x)
          Public user API: Propagation events updating the lower bound of a variable (ie: removing all value strictly below the new lower bound from the domain).
 void setMax(int x)
          Deprecated. replaced by setMax
 void setMin(int x)
          Deprecated. replaced by setInf
 void setSup(int x)
          Public user API: Propagation events updating the upper bound of a variable (ie: removing all value strictly above the new upper bound from the domain).
 void setVal(int x)
          Public user API: Propagation events assigning a value to a variable (ie: removing all other values from its domain).
 boolean updateInf(int x, int idx)
          Propagation events updating the lower bound of a variable (ie: removing all value strictly below the new lower bound from the domain).
 boolean updateSup(int x, int idx)
          Propagation events updating the upper bound of a variable (ie: removing all value strictly above the new upper bound from the domain).
 void wipeOut()
          Public user API: Propagation events wiping out the domain of the variable (removing all values) and throwing a contradiction
 
Methods inherited from interface choco.Var
addConstraint, fail, getConstraint, getConstraintsIterator, getConstraintVector, getEvent, getIndexVector, getNbConstraints, getVarIndex, isInstantiated
 
Methods inherited from interface choco.Entity
pretty
 

Field Detail

LIST

static final int LIST
Public user API: static constants associated to the encoding of the variable domain these constants are passed as parameters to the constructor of IntVars LIST = a chained list of values

See Also:
Constant Field Values

BOUNDS

static final int BOUNDS
Public user API: static constants associated to the encoding of the variable domain these constants are passed as parameters to the constructor of IntVars BOUNDS = an interval (keeping the lower and upper bounds)

See Also:
Constant Field Values
Method Detail

setVal

void setVal(int x)
            throws ContradictionException
Public user API: Propagation events assigning a value to a variable (ie: removing all other values from its domain).

Parameters:
x - the value that is assigned to the variable
Throws:
ContradictionException

remVal

void remVal(int x)
            throws ContradictionException
Public user API: Propagation events removing a value from the domain of a variable.

Parameters:
x - the removed value
Throws:
ContradictionException

setInf

void setInf(int x)
            throws ContradictionException
Public user API: Propagation events updating the lower bound of a variable (ie: removing all value strictly below the new lower bound from the domain).

Parameters:
x - the new lower bound
Throws:
ContradictionException

setMin

void setMin(int x)
            throws ContradictionException
Deprecated. replaced by setInf

Throws:
ContradictionException

setSup

void setSup(int x)
            throws ContradictionException
Public user API: Propagation events updating the upper bound of a variable (ie: removing all value strictly above the new upper bound from the domain).

Parameters:
x - the new upper bound
Throws:
ContradictionException

setMax

void setMax(int x)
            throws ContradictionException
Deprecated. replaced by setMax

Throws:
ContradictionException

wipeOut

void wipeOut()
             throws ContradictionException
Public user API: Propagation events wiping out the domain of the variable (removing all values) and throwing a contradiction

Throws:
ContradictionException

hasEnumeratedDomain

boolean hasEnumeratedDomain()
Public user API: Domains : whether an enumeration of values (in addition to the enclosing interval) is stored


getDomain

IntDomain getDomain()
Public user API: Domains : returns the object responsible for storing the enumeration of values in the domain


isInstantiatedTo

boolean isInstantiatedTo(int x)
Public user API: Domains : testing whether the value of an instantiated variable is equal to a specific value.


canBeInstantiatedTo

boolean canBeInstantiatedTo(int x)
Public user API: Domains : testing whether a value is in the domain.

Parameters:
x - the tested value

canBeEqualTo

boolean canBeEqualTo(IntDomainVar x)
Public user API: Domains : testing whether two variables have intersecting domains.

Parameters:
x - the other variable

canBeInstantiatedIn

boolean canBeInstantiatedIn(int[] sortedValList,
                            int nVals)
Public user API: Domains : testing whether one value among a list is present in the domain.

Parameters:
sortedValList - the list of values. Must be sorted in increasing order.
nVals - the size of the list of values

getRandomDomainValue

int getRandomDomainValue()
Public user API: Domains : retrieves a value drawn at random (uniform distribution) from the domain.


getNextDomainValue

int getNextDomainValue(int i)
Public user API: Domains : retrieves the value immediately (but strictly) after i in the domain

Parameters:
i - the pivot value. May or may not be in the domain

getPrevDomainValue

int getPrevDomainValue(int i)
Public user API: Domains : retrieves the value immediately (but strictly) before i in the domain.

Parameters:
i - the pivot value. May or may not be in the domain

getDomainSize

int getDomainSize()
Public user API: Domains : retrieves the number of values in the domain.


getProblem

AbstractProblem getProblem()
Public user API: Util : retrieves the problem to which the variable belongs.

Specified by:
getProblem in interface Entity

getInf

int getInf()
Returns the lower bound of the variable domain (e.g. the smallest value that the variable can be assigned).

Returns:
the domain lower bound

getSup

int getSup()
Returns the upper bound of the variable domain (e.g. the greatest value that the variable can be assigned).

Returns:
the domain upper bound

getVal

int getVal()
Returns the value of the variable if instantiated.

Returns:
the value of the variable

getValue

int getValue()
Deprecated. replaced by getVal


updateInf

boolean updateInf(int x,
                  int idx)
                  throws ContradictionException
Propagation events updating the lower bound of a variable (ie: removing all value strictly below the new lower bound from the domain).

Parameters:
x - a lower bound of the domain (the new one, if better than the one currently stored)
idx - the index of the constraint that generated the var
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException

updateSup

boolean updateSup(int x,
                  int idx)
                  throws ContradictionException
Propagation events updating the upper bound of a variable (ie: removing all value strictly above the new upper bound from the domain).

Parameters:
x - an upper bound of the domain (the new one, if better than the one currently stored)
idx - the index of the constraint that generated the var
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException

removeVal

boolean removeVal(int x,
                  int idx)
                  throws ContradictionException
Propagation events updating the domain of a variable (by removing a value)

Parameters:
x - the value that is not in the domain
idx - the index of the constraint that generated the var
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException

removeInterval

boolean removeInterval(int a,
                       int b,
                       int idx)
                       throws ContradictionException
Propagation events updating the domain of a variable (by removing an interval, ie, a sequence of consecutive values)

Parameters:
a - the lower bound of the forbidden interval
b - the upper bound of the forbidden interval
idx - the index of the constraint that generated the var
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException

instantiate

boolean instantiate(int x,
                    int idx)
                    throws ContradictionException
Propagation events instantiating a variable (ie: removing all other values from the domain)

Parameters:
x - the value of the variable
idx - the index of the constraint that generated the var
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException