|
||||||||||
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>
choco.cp.solver.variables.integer.BooleanVarImpl<C>
public class BooleanVarImpl<C extends AbstractSConstraint & IntPropagator>
A variable implementation dedicated to boolean domains
Field Summary | |
---|---|
protected BooleanDomain |
booldomain
A reference to the domain |
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 | |
---|---|
BooleanVarImpl(Solver solver,
String name)
|
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 that x is 0 or 1 |
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. |
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,
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, 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 |
Field Detail |
---|
protected BooleanDomain booldomain
Constructor Detail |
---|
public BooleanVarImpl(Solver solver, String name)
Method Detail |
---|
public final boolean isInstantiatedTo(int x)
isInstantiatedTo
in interface IntVar
isInstantiatedTo
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
x
- the tested value
public final boolean isInstantiated()
isInstantiated
in interface Var
isInstantiated
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final boolean canBeInstantiatedTo(int x)
canBeInstantiatedTo
in interface IntDomainVar
canBeInstantiatedTo
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
x
- the tested value
public final boolean fastCanBeInstantiatedTo(int x)
fastCanBeInstantiatedTo
in interface IntDomainVar
fastCanBeInstantiatedTo
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public boolean hasEnumeratedDomain()
IntDomainVar
hasEnumeratedDomain
in interface IntDomainVar
hasEnumeratedDomain
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public boolean hasBooleanDomain()
IntDomainVar
hasBooleanDomain
in interface IntDomainVar
hasBooleanDomain
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final int getDomainSize()
getDomainSize
in interface IntDomainVar
getDomainSize
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final boolean canBeEqualTo(IntDomainVar x)
canBeEqualTo
in interface IntDomainVar
canBeEqualTo
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
x
- the other variable
public final IntDomain getDomain()
IntDomainVar
getDomain
in interface IntDomainVar
getDomain
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final boolean canBeInstantiatedIn(int[] sortedValList, int nVals)
canBeInstantiatedIn
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
sortedValList
- The value array.nVals
- The number of interesting value in this array.public int getRandomDomainValue()
getRandomDomainValue
in interface IntDomainVar
getRandomDomainValue
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final int getNextDomainValue(int currentv)
getNextDomainValue
in interface IntDomainVar
getNextDomainValue
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
currentv
- the pivot value. May or may not be in the domain
public final int getPrevDomainValue(int currentv)
getPrevDomainValue
in interface IntDomainVar
getPrevDomainValue
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
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<C extends AbstractSConstraint & IntPropagator>
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<C extends AbstractSConstraint & IntPropagator>
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<C extends AbstractSConstraint & IntPropagator>
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<C extends AbstractSConstraint & IntPropagator>
a
- the first removed valueb
- the last removed valuecause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic final boolean instantiate(int x, SConstraint cause, boolean forceAwake) throws ContradictionException
instantiate
in interface IntDomainVar
instantiate
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
x
- the new upper boundcause
- forceAwake
-
ContradictionException
- contradiction exceptionpublic final int getInf()
getInf
in interface IntDomainVar
getInf
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final int getSup()
getSup
in interface IntDomainVar
getSup
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final int getVal()
getVal
in interface IntVar
getVal
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public final int getValue()
getValue
in interface IntDomainVar
getValue
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public String toString()
toString
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
public String pretty()
IntDomainVarImpl
pretty
in interface IPretty
pretty
in class IntDomainVarImpl<C extends AbstractSConstraint & IntPropagator>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |