public final class EqView extends IntBoolView
ReExpression.Operator
cste
mIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagators
MAX_INT_BOUND, MIN_INT_BOUND
BOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEW
NO_CHILD
Constructor and Description |
---|
EqView(IntVar var,
int cste)
A boolean view based on var such that var = cste
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int value)
Checks if a value
v belongs to the domain of this |
void |
explain(ExplanationForSignedClause explanation,
ValueSortedMap<IntVar> front,
Implications ig,
int p)
Clausal explanation for this cause.
|
ESat |
getBooleanValue() |
int |
getLB()
Retrieves the lower bound of the variable
|
int |
getUB()
Retrieves the upper bound of the variable
|
boolean |
instantiateTo(int value,
ICause cause)
Instantiates the domain of
this to value . |
boolean |
isInstantiated()
Indicates whether
this is instantiated (see implemtations to know what instantiation means). |
boolean |
isInstantiatedTo(int value)
Checks wether
this is instantiated to val |
void |
justifyEvent(IntEventType mask,
int one,
int two,
int three)
This methods is related to explanations, it binds an event occurring on the observed
variable to the view.
|
int |
nextValue(int v)
Returns the first value just after v in
this which is in the domain. |
int |
nextValueOut(int v)
Returns the first value just after v in
this which is out of the domain. |
int |
previousValue(int v)
Returns the previous value just before v in
this . |
int |
previousValueOut(int v)
Returns the first value just before v in
this which is out of the domain. |
_setNot, createDelta, createScheduler, getRangeIterator, getTypeAndKind, getValue, getValueIterator, hasNot, isLit, isNot, monitorDelta, not, removeAllValuesBut, removeInterval, removeValue, removeValues, setNot, setToFalse, setToTrue, toString, updateBounds, updateLowerBound, updateUpperBound
compareTo, doInstantiateVar, doRemoveIntervalFromVar, doRemoveValueFromVar, doUpdateLowerBoundOfVar, doUpdateUpperBoundOfVar, forEachIntVar, getDelta, getDomainSize, getRange, getVariable, hasEnumeratedDomain, iterator, notify, transformEvent
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDindex, getEvtScheduler, getId, getIndexInPropagator, getMask, getModel, getName, getNbProps, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, isBool, link, notifyMonitors, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
boolVar, extractVar, intVar
forEachIntVar, getDomainSize, getNoChild, getRange, hasEnumeratedDomain, isBool, isExpressionLeaf, transformEvent
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDelta, getDindex, getEnvironment, getEvtScheduler, getIndexInPropagator, getMask, getModel, getName, getNbProps, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, link, notifyMonitors, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
compareTo
forEach, iterator, spliterator
public EqView(IntVar var, int cste)
var
- an integer variablecste
- an intpublic ESat getBooleanValue()
public boolean instantiateTo(int value, ICause cause) throws ContradictionException
IntVar
this
to value
. The instruction comes from propagator
.
this
is already instantiated to value
,
nothing is done and the return value is false
,this
is already instantiated to another value,
then a ContradictionException
is thrown,this
is restricted to value
and the observers are notified
and the return value is true
.instantiateTo
in interface IntVar
instantiateTo
in class IntView<IntVar>
value
- instantiation value (int)cause
- instantiation releaserContradictionException
- if the domain become empty due to this actionpublic boolean isInstantiated()
Variable
this
is instantiated (see implemtations to know what instantiation means).isInstantiated
in interface Variable
isInstantiated
in class IntView<IntVar>
true
if this
is instantiatedpublic boolean contains(int value)
IntVar
v
belongs to the domain of this
value
- inttrue
if the value belongs to the domain of this
, false
otherwise.public boolean isInstantiatedTo(int value)
IntVar
this
is instantiated to val
value
- intthis
is instantiated to val
, false otherwisepublic int getLB()
IntVar
public int getUB()
IntVar
public int nextValue(int v)
IntVar
this
which is in the domain.
If no such value exists, returns Integer.MAX_VALUE;
To iterate over the values in a IntVar
,
use the following loop:
int ub = iv.getUB(); for (int i = iv.getLB(); i <= ub; i = iv.nextValue(i)) { // operate on value i here }
v
- the value to start checking (exclusive)public int nextValueOut(int v)
IntVar
this
which is out of the domain.
If v is less than or equal to IntVar.getLB()
-2, returns v + 1,
if v is greater than or equal to IntVar.getUB()
, returns v + 1.v
- the value to start checking (exclusive)public int previousValue(int v)
IntVar
this
.
If no such value exists, returns Integer.MIN_VALUE;
To iterate over the values in a IntVar
,
use the following loop:
int lb = iv.getLB(); for (int i = iv.getUB(); i >= lb; i = iv.previousValue(i)) { // operate on value i here }
v
- the value to start checking (exclusive)public int previousValueOut(int v)
IntVar
this
which is out of the domain.
If v is greater than or equal to IntVar.getUB()
+2, returns v - 1,
if v is less than or equal to IntVar.getLB()
, returns v - 1.v
- the value to start checking (exclusive)public void justifyEvent(IntEventType mask, int one, int two, int three)
IView
mask
- type of modificationone
- an inttwo
- an intthree
- an intpublic void explain(ExplanationForSignedClause explanation, ValueSortedMap<IntVar> front, Implications ig, int p)
ICause
This method must filled explanations with inferred literals. These literals are inferred from the analysis of (a subset of) conflicting nodes stored in front, the implication graph ig and the current node in conflict, not yet contained in front.
Optionally, this method can update front by looking for a predecessor of any node that seems more relevant than the declared one.
explanation
- explanation to computefront
- ordered map of (variable,node> in the conflict frontier of the implication graph.ig
- an implication graphp
- the pivot node out of frontCopyright © 2018. All rights reserved.