|
||||||||||
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<C>
public class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
Implements search valued domain variables.
Field Summary | |
---|---|
protected AbstractIntDomain |
domain
The backtrackable domain of the variable. |
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 | |
---|---|
protected |
IntDomainVarImpl(Solver solver,
String name)
Default constructor |
|
IntDomainVarImpl(Solver solver,
String name,
int domainType,
int[] distinctSortedValues)
|
|
IntDomainVarImpl(Solver solver,
String name,
int domainType,
int a,
int b)
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 |
int |
fastNextDomainValue(int i)
retrieves the value immediately (but strictly) after i in the domain, assuming the value is greater or equal to the lower bound. |
int |
fastPrevDomainValue(int i)
retrieves the value immediately (but strictly) before i in the domain, assuming the value is less or equal to the upper bound. |
DisposableIterator<Couple<C>> |
getActiveConstraints(int evtType,
C cstrCause)
|
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. |
PartiallyStoredIntVector[] |
getEventsVector()
|
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. |
int |
getValue()
Deprecated. replaced by getVal |
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,
int idx)
Deprecated. |
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,
int idx)
Deprecated. |
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,
int idx)
Deprecated. |
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. |
void |
remVal(int x)
Removes a value. |
void |
setInf(int x)
Sets the minimum value. |
void |
setMax(int x)
Deprecated. replaced by setSup |
void |
setMin(int x)
Deprecated. replaced by setInf |
void |
setSup(int x)
Sets the maximal value. |
void |
setVal(int x)
Instantiates the variable. |
String |
toString()
pretty printing |
boolean |
updateInf(int x,
int idx)
Deprecated. |
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,
int idx)
Deprecated. |
boolean |
updateSup(int x,
SConstraint cause,
boolean forceAwake)
Internal var: update on the variable upper bound caused by its i-th constraint. |
void |
wipeOut()
Public user API: Propagation events wiping out the domain of the variable (removing all values) and throwing a contradiction |
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 |
---|
protected AbstractIntDomain domain
Constructor Detail |
---|
protected IntDomainVarImpl(Solver solver, String name)
solver
- master solvername
- name of the variablepublic IntDomainVarImpl(Solver solver, String name, int domainType, int a, int b)
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 IntDomainVarImpl(Solver solver, String name, int domainType, int[] distinctSortedValues)
Method Detail |
---|
public final DisposableIterator<Couple<C>> getActiveConstraints(int evtType, C cstrCause)
public final PartiallyStoredIntVector[] getEventsVector()
public boolean isInstantiatedTo(int x)
isInstantiatedTo
in interface IntVar
x
- the tested value
public boolean isInstantiated()
isInstantiated
in interface Var
public boolean canBeInstantiatedTo(int x)
canBeInstantiatedTo
in interface IntDomainVar
x
- the tested value
public boolean fastCanBeInstantiatedTo(int x)
fastCanBeInstantiatedTo
in interface IntDomainVar
public void setInf(int x) throws ContradictionException
setInf
in interface IntDomainVar
x
- the new lower bound
ContradictionException
- contradiction exceptionpublic void setMin(int x) throws ContradictionException
setMin
in interface IntDomainVar
x
- the new inf value
ContradictionException
- contradiction exceptionpublic void setSup(int x) throws ContradictionException
setSup
in interface IntDomainVar
x
- the new upper bound
ContradictionException
- contradiction exceptionpublic void setMax(int x) throws ContradictionException
setMax
in interface IntDomainVar
x
- the new max value
ContradictionException
- contradiction exceptionpublic void setVal(int x) throws ContradictionException
setVal
in interface IntVar
x
- the value that is assigned to the variable
ContradictionException
public void remVal(int x) throws ContradictionException
remVal
in interface IntDomainVar
x
- the removed value
ContradictionException
public void wipeOut() throws ContradictionException
IntDomainVar
wipeOut
in interface IntDomainVar
ContradictionException
- contradiction exceptionpublic boolean hasEnumeratedDomain()
IntDomainVar
hasEnumeratedDomain
in interface IntDomainVar
public boolean hasBooleanDomain()
IntDomainVar
hasBooleanDomain
in interface IntDomainVar
public IntDomain getDomain()
IntDomainVar
getDomain
in interface IntDomainVar
public int getDomainSize()
getDomainSize
in interface IntDomainVar
public boolean canBeEqualTo(IntDomainVar x)
canBeEqualTo
in interface IntDomainVar
x
- the other variable
public boolean canBeInstantiatedIn(int[] sortedValList, int nVals)
sortedValList
- The value array.nVals
- The number of interesting value in this array.public int getRandomDomainValue()
getRandomDomainValue
in interface IntDomainVar
public int getNextDomainValue(int currentv)
getNextDomainValue
in interface IntDomainVar
currentv
- the pivot value. May or may not be in the domain
public int fastNextDomainValue(int i)
IntDomainVar
fastNextDomainValue
in interface IntDomainVar
public int getPrevDomainValue(int currentv)
getPrevDomainValue
in interface IntDomainVar
currentv
- the pivot value. May or may not be in the domain
public int fastPrevDomainValue(int i)
IntDomainVar
fastPrevDomainValue
in interface IntDomainVar
public boolean updateInf(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
updateInf
in interface IntDomainVar
x
- The new lower bound.cause
- forceAwake
-
ContradictionException
- contradiction exception@Deprecated public boolean updateInf(int x, int idx) throws ContradictionException
updateInf
in interface IntDomainVar
ContradictionException
public boolean updateSup(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
updateSup
in interface IntDomainVar
x
- The new upper boundcause
- forceAwake
-
ContradictionException
- contradiction exception@Deprecated public boolean updateSup(int x, int idx) throws ContradictionException
updateSup
in interface IntDomainVar
ContradictionException
public boolean removeVal(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
removeVal
in interface IntDomainVar
x
- The removed valuecause
- forceAwake
-
ContradictionException
- contradiction exception@Deprecated public boolean removeVal(int x, int idx) throws ContradictionException
removeVal
in interface IntDomainVar
ContradictionException
public boolean removeInterval(int a, int b, SConstraint cause, boolean forceAwake) throws ContradictionException
removeInterval
in interface IntDomainVar
a
- the first removed valueb
- the last removed valuecause
- forceAwake
-
ContradictionException
- contradiction exception@Deprecated public boolean removeInterval(int a, int b, int idx) throws ContradictionException
removeInterval
in interface IntDomainVar
ContradictionException
public boolean instantiate(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
instantiate
in interface IntDomainVar
x
- the new upper boundcause
- forceAwake
-
ContradictionException
- contradiction exception@Deprecated public boolean instantiate(int x, int idx) throws ContradictionException
instantiate
in interface IntDomainVar
ContradictionException
public int getInf()
getInf
in interface IntDomainVar
public int getSup()
getSup
in interface IntDomainVar
public int getVal()
getVal
in interface IntVar
public int getValue()
getValue
in interface IntDomainVar
public String toString()
toString
in class AbstractVar
public String pretty()
pretty
in interface IPretty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |