|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.variables.AbstractVar
choco.cp.solver.variables.integer.IntDomainVarImpl
choco.cp.solver.variables.integer.ViewIntDomainVarImpl
public class ViewIntDomainVarImpl
Field Summary |
---|
Fields inherited from class choco.cp.solver.variables.integer.IntDomainVarImpl |
---|
domain |
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 | |
---|---|
ViewIntDomainVarImpl(Solver solver,
String name,
int domainType,
int[] sortedValues,
int coeff,
int cst)
|
|
ViewIntDomainVarImpl(Solver solver,
String name,
int domainType,
int a,
int b,
int coeff,
int cst)
Constructs a new variable for the specified model and with the specified name and bounds. |
Method Summary | |
---|---|
boolean |
canBeEqualTo(IntDomainVar x)
Checks if it can be equals to another variable. |
boolean |
canBeInstantiatedIn(int[] sortedValList,
int nVals)
Checks if the variables can be instantiated to at least one value in the array. |
boolean |
canBeInstantiatedTo(int x)
Checks if a value is still 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 |
IntDomain |
getDomain()
Public user API: Domains : returns the object responsible for storing the enumeration of values in the domain |
int |
getDomainSize()
Gets the domain size. |
int |
getInf()
Gets the minimal value of the variable. |
int |
getNextDomainValue(int currentv)
Gets the next value in the domain. |
int |
getPrevDomainValue(int currentv)
Gets the previous value in the domain. |
int |
getRandomDomainValue()
Returns a randomly choosed value in the domain. |
int |
getSup()
Gets the maximal value of the variable. |
int |
getVal()
Gets the value of the variable if instantiated. |
boolean |
hasBooleanDomain()
Public user API: Domains : whether the domain is a 0/1 domain |
boolean |
hasEnumeratedDomain()
Public user API: Domains : whether an enumeration of values (in addition to the enclosing interval) is stored |
boolean |
instantiate(int x,
SConstraint cause,
boolean forceAwake)
Internal var: instantiation of the variable caused by its i-th constraint Returns a boolean indicating whether the call indeed added new information. |
boolean |
isInstantiated()
Checks if the variables is instantiated to any value. |
boolean |
isInstantiatedTo(int x)
Checks if the variable is instantiated to a specific value. |
String |
pretty()
pretty printing |
boolean |
removeInterval(int a,
int b,
SConstraint cause,
boolean forceAwake)
Internal var: remove an interval (a sequence of consecutive values) from the domain of a variable caused by its i-th constraint. |
boolean |
removeVal(int x,
SConstraint cause,
boolean forceAwake)
Internal var: update (value removal) on the domain of a variable caused by its i-th constraint. |
String |
toString()
pretty printing |
boolean |
updateInf(int x,
SConstraint cause,
boolean forceAwake)
Internal var: update on the variable lower bound caused by its i-th constraint. |
boolean |
updateSup(int x,
SConstraint cause,
boolean forceAwake)
Internal var: update on the variable upper bound caused by its i-th constraint. |
Methods inherited from class choco.cp.solver.variables.integer.IntDomainVarImpl |
---|
fastNextDomainValue, fastPrevDomainValue, getActiveConstraints, getEventsVector, getValue, instantiate, removeInterval, removeVal, remVal, setInf, setMax, setMin, setSup, setVal, updateInf, updateSup, wipeOut |
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 |
Constructor Detail |
---|
public ViewIntDomainVarImpl(Solver solver, String name, int domainType, int a, int b, int coeff, int cst)
solver
- The model of the variable.name
- Its name.domainType
- the type of encoding for the domain (BOUNDS, BITSET, ...)a
- Its minimal value.b
- Its maximal value.public ViewIntDomainVarImpl(Solver solver, String name, int domainType, int[] sortedValues, int coeff, int cst)
Method Detail |
---|
public boolean isInstantiatedTo(int x)
isInstantiatedTo
in interface IntVar
isInstantiatedTo
in class IntDomainVarImpl
x
- the tested value
public boolean isInstantiated()
isInstantiated
in interface Var
isInstantiated
in class IntDomainVarImpl
public boolean canBeInstantiatedTo(int x)
canBeInstantiatedTo
in interface IntDomainVar
canBeInstantiatedTo
in class IntDomainVarImpl
x
- the tested value
public boolean fastCanBeInstantiatedTo(int x)
fastCanBeInstantiatedTo
in interface IntDomainVar
fastCanBeInstantiatedTo
in class IntDomainVarImpl
public boolean hasEnumeratedDomain()
IntDomainVar
hasEnumeratedDomain
in interface IntDomainVar
hasEnumeratedDomain
in class IntDomainVarImpl
public boolean hasBooleanDomain()
IntDomainVar
hasBooleanDomain
in interface IntDomainVar
hasBooleanDomain
in class IntDomainVarImpl
public IntDomain getDomain()
IntDomainVar
getDomain
in interface IntDomainVar
getDomain
in class IntDomainVarImpl
public int getDomainSize()
getDomainSize
in interface IntDomainVar
getDomainSize
in class IntDomainVarImpl
public boolean canBeEqualTo(IntDomainVar x)
canBeEqualTo
in interface IntDomainVar
canBeEqualTo
in class IntDomainVarImpl
x
- the other variable
public boolean canBeInstantiatedIn(int[] sortedValList, int nVals)
canBeInstantiatedIn
in class IntDomainVarImpl
sortedValList
- The value array.nVals
- The number of interesting value in this array.public int getRandomDomainValue()
getRandomDomainValue
in interface IntDomainVar
getRandomDomainValue
in class IntDomainVarImpl
public int getNextDomainValue(int currentv)
getNextDomainValue
in interface IntDomainVar
getNextDomainValue
in class IntDomainVarImpl
currentv
- the pivot value. May or may not be in the domain
public int getPrevDomainValue(int currentv)
getPrevDomainValue
in interface IntDomainVar
getPrevDomainValue
in class IntDomainVarImpl
currentv
- the pivot value. May or may not be in the domain
public boolean updateInf(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
updateInf
in interface IntDomainVar
updateInf
in class IntDomainVarImpl
x
- The new lower bound.cause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic boolean updateSup(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
updateSup
in interface IntDomainVar
updateSup
in class IntDomainVarImpl
x
- The new upper boundcause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic boolean removeVal(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
removeVal
in interface IntDomainVar
removeVal
in class IntDomainVarImpl
x
- The removed valuecause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic boolean removeInterval(int a, int b, SConstraint cause, boolean forceAwake) throws ContradictionException
removeInterval
in interface IntDomainVar
removeInterval
in class IntDomainVarImpl
a
- the first removed valueb
- the last removed valuecause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic boolean instantiate(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
instantiate
in interface IntDomainVar
instantiate
in class IntDomainVarImpl
x
- the new upper boundcause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic int getInf()
getInf
in interface IntDomainVar
getInf
in class IntDomainVarImpl
public int getSup()
getSup
in interface IntDomainVar
getSup
in class IntDomainVarImpl
public int getVal()
getVal
in interface IntVar
getVal
in class IntDomainVarImpl
public String toString()
toString
in class IntDomainVarImpl
public String pretty()
pretty
in interface IPretty
pretty
in class IntDomainVarImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |