choco.cp.solver.variables.integer
Class IntDomainVarAddCste

java.lang.Object
  extended by choco.kernel.solver.variables.AbstractVar
      extended by choco.cp.solver.variables.integer.AbstractBijectiveVar
          extended by choco.cp.solver.variables.integer.IntDomainVarAddCste
All Implemented Interfaces:
IExtensionnable, IPretty, IIndex, IntExp, IntDomainVar, IntVar, Var

public class IntDomainVarAddCste
extends AbstractBijectiveVar

Declare a variable Y, based on a variable X and a constante c, such as Y = X + c

Since:
18/02/11
Author:
Charles Prud'homme

Field Summary
 
Fields inherited from class choco.kernel.solver.variables.AbstractVar
constraints, event, extensions, name, propagationEngine
 
Fields inherited from interface choco.kernel.solver.variables.integer.IntDomainVar
BINARYTREE, BIPARTITELIST, BITSET, BOOLEAN, BOUNDS, LINKEDLIST, ONE_VALUE
 
Fields inherited from interface choco.kernel.solver.variables.Var
LOGGER
 
Constructor Summary
IntDomainVarAddCste(Solver solver, String name, IntDomainVar variable, int constante)
          Build a variable Y such as Y = X + c.
 
Method Summary
 boolean canBeInstantiatedTo(int x)
          Public user API: Domains : testing whether a value is in the domain.
 boolean fastCanBeInstantiatedTo(int x)
          Checks if a value is still in the domain assuming the value is in the initial bound of 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.
 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()
           
 boolean instantiate(int x, int idx)
           
 boolean instantiate(int x, SConstraint cause, boolean forceAwake)
          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.
 String pretty()
          pretty printing of the object.
 boolean removeInterval(int a, int b, int idx)
           
 boolean removeInterval(int a, int b, SConstraint cause, boolean forceAwake)
          Propagation events updating the domain of a variable (by removing an interval, ie, a sequence of consecutive values)
 boolean removeVal(int x, int idx)
           
 boolean removeVal(int x, SConstraint cause, boolean forceAwake)
          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. 
 void setMin(int x)
          Deprecated. 
 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)
           
 boolean updateInf(int x, SConstraint cause, boolean forceAwake)
          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)
           
 boolean updateSup(int x, SConstraint cause, boolean forceAwake)
          Propagation events updating the upper bound of a variable (ie: removing all value strictly above the new upper bound from the domain).
 
Methods inherited from class choco.cp.solver.variables.integer.AbstractBijectiveVar
addConstraint, canBeEqualTo, eraseConstraint, fastNextDomainValue, fastPrevDomainValue, getConstraint, getConstraintsIterator, getConstraintVector, getDomain, getDomainSize, getEvent, getIndexVector, getNbConstraints, getVarIndex, hasBooleanDomain, hasEnumeratedDomain, isInstantiated, wipeOut
 
Methods inherited from class choco.kernel.solver.variables.AbstractVar
addExtension, getAbstractVarExtensionNumber, getExtension, getIndex, getName, getPriority, hashCode, toString
 
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
getName, getPriority
 
Methods inherited from interface choco.kernel.common.IIndex
getIndex
 
Methods inherited from interface choco.IExtensionnable
addExtension, getExtension
 

Constructor Detail

IntDomainVarAddCste

public IntDomainVarAddCste(Solver solver,
                           String name,
                           IntDomainVar variable,
                           int constante)
Build a variable Y such as Y = X + c.

Parameters:
solver - The model this variable belongs to
name - The name of the variable
variable - constraints stored specific structure
Method Detail

remVal

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

Parameters:
x - the removed value
Throws:
ContradictionException - contradiction exception

setInf

public void setInf(int x)
            throws ContradictionException
Description copied from interface: IntDomainVar
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 - contradiction exception

setMin

@Deprecated
public void setMin(int x)
            throws ContradictionException
Deprecated. 

Parameters:
x - the new inf value
Throws:
ContradictionException - contradiction exception

setSup

public void setSup(int x)
            throws ContradictionException
Description copied from interface: IntDomainVar
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 - contradiction exception

setMax

@Deprecated
public void setMax(int x)
            throws ContradictionException
Deprecated. 

Parameters:
x - the new max value
Throws:
ContradictionException - contradiction exception

canBeInstantiatedTo

public boolean canBeInstantiatedTo(int x)
Description copied from interface: IntDomainVar
Public user API: Domains : testing whether a value is in the domain.

Parameters:
x - the tested value
Returns:
wether a value is in the domain

fastCanBeInstantiatedTo

public boolean fastCanBeInstantiatedTo(int x)
Description copied from interface: IntDomainVar
Checks if a value is still in the domain assuming the value is in the initial bound of the domain


getRandomDomainValue

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

Returns:
a value drawn at random from the domain

getNextDomainValue

public int getNextDomainValue(int i)
Description copied from interface: IntDomainVar
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
Returns:
the value immediatly after the domain

getPrevDomainValue

public int getPrevDomainValue(int i)
Description copied from interface: IntDomainVar
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
Returns:
the value immediatly before the domain

getInf

public int getInf()
Description copied from interface: IntDomainVar
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

public int getSup()
Description copied from interface: IntDomainVar
Returns the upper bound of the variable domain (e.g. the greatest value that the variable can be assigned).

Returns:
the domain upper bound

getValue

public int getValue()
Returns:
the value of the variable if known

updateInf

public boolean updateInf(int x,
                         SConstraint cause,
                         boolean forceAwake)
                  throws ContradictionException
Description copied from interface: IntDomainVar
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)
cause - constraint that modified the x
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException - contradiction exception

updateInf

public boolean updateInf(int x,
                         int idx)
                  throws ContradictionException
Throws:
ContradictionException

updateSup

public boolean updateSup(int x,
                         SConstraint cause,
                         boolean forceAwake)
                  throws ContradictionException
Description copied from interface: IntDomainVar
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)
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException - contradiction exception

updateSup

public boolean updateSup(int x,
                         int idx)
                  throws ContradictionException
Throws:
ContradictionException

removeVal

public boolean removeVal(int x,
                         SConstraint cause,
                         boolean forceAwake)
                  throws ContradictionException
Description copied from interface: IntDomainVar
Propagation events updating the domain of a variable (by removing a value)

Parameters:
x - the value that is not in the domain
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException - contradiction exception

removeVal

public boolean removeVal(int x,
                         int idx)
                  throws ContradictionException
Throws:
ContradictionException

removeInterval

public boolean removeInterval(int a,
                              int b,
                              SConstraint cause,
                              boolean forceAwake)
                       throws ContradictionException
Description copied from interface: IntDomainVar
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
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException - contradiction exception

removeInterval

public boolean removeInterval(int a,
                              int b,
                              int idx)
                       throws ContradictionException
Throws:
ContradictionException

instantiate

public boolean instantiate(int x,
                           SConstraint cause,
                           boolean forceAwake)
                    throws ContradictionException
Description copied from interface: IntDomainVar
Propagation events instantiating a variable (ie: removing all other values from the domain)

Parameters:
x - the value of the variable
Returns:
a boolean indicating whether this method call added new information or not
Throws:
ContradictionException - contradiction exception

instantiate

public boolean instantiate(int x,
                           int idx)
                    throws ContradictionException
Throws:
ContradictionException

setVal

public void setVal(int x)
            throws ContradictionException
Description copied from interface: IntVar
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 - contradiction exception

getVal

public int getVal()
Description copied from interface: IntVar
Returns the value of the variable if instantiated.

Returns:
the value of the variable

isInstantiatedTo

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

Parameters:
x - the tested value
Returns:
wether the value of an instantiated variables is equal to a x.

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.

Returns:
a readable string representation of the object


Copyright © 2012. All Rights Reserved.