public class FixedRealVarImpl extends AbstractVariable implements RealVar
Project: choco-solver.
CArExpression.OperatormIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagatorsBOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEWNO_CHILD| Constructor and Description |
|---|
FixedRealVarImpl(String name,
double value,
Model model)
Create the shared data of any type of variable.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createDelta()
Create a delta, if necessary, in order to observe removed values of a this.
|
IDelta |
getDelta()
Return the delta domain of this
|
double |
getLB()
Retrieves the lower bound of the variable
|
double |
getPrecision() |
int |
getTypeAndKind()
Return a MASK composed of 2 main information: TYPE and KIND.
|
double |
getUB()
Retrieves the upper bound of the variable
|
boolean |
isInstantiated()
Indicates whether
this is instantiated (see implemtations to know what instantiation means). |
void |
notifyMonitors(IEventType event)
Notify monitors of observed variable modifications
|
boolean |
updateBounds(double lowerbound,
double upperbound,
ICause cause)
Updates the bounds of the domain of
this to value. |
boolean |
updateLowerBound(double value,
ICause cause)
Updates the lower bound of the domain of
this to value. |
boolean |
updateUpperBound(double value,
ICause cause)
Updates the upper bound of the domain of
this to value. |
_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, compareTo, contradiction, getCause, getDindex, getId, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, isBool, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, toString, unlinkclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDindex, getEnvironment, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlinkcompareToabs, acos, acosh, add, add, asin, asinh, atan, atan2, atan2, atanh, cos, cosh, div, div, eq, eq, exp, ge, ge, getModel, gt, gt, le, le, ln, lt, lt, max, max, min, min, mul, mul, neg, pow, pow, sin, sinh, sqrt, sub, sub, tan, tanhpublic double getLB()
RealVarpublic double getUB()
RealVarpublic boolean updateLowerBound(double value,
ICause cause)
throws ContradictionException
RealVarthis to value.
The instruction comes from propagator.
value is smaller than the lower bound of the domain, nothing is done and the return value is false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueupdateLowerBound in interface RealVarvalue - new lower bound (included)cause - updating releaserContradictionException - if the domain become empty due to this actionpublic boolean updateUpperBound(double value,
ICause cause)
throws ContradictionException
RealVarthis to value.
The instruction comes from propagator.
value is greater than the upper bound of the domain, nothing is done and the return value is false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueupdateUpperBound in interface RealVarvalue - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic boolean updateBounds(double lowerbound,
double upperbound,
ICause cause)
throws ContradictionException
RealVarthis to value.
The instruction comes from propagator.
lowerbound,upperbound] includes the domain of this, nothing is done and the return value is false,ContradictionException is thrown,trueupdateBounds in interface RealVarlowerbound - new lower bound (included)upperbound - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic double getPrecision()
getPrecision in interface RealVarpublic boolean isInstantiated()
Variablethis is instantiated (see implemtations to know what instantiation means).isInstantiated in interface Variabletrue if this is instantiatedpublic IDelta getDelta()
Variablepublic void createDelta()
VariablecreateDelta in interface Variablepublic void notifyMonitors(IEventType event) throws ContradictionException
VariablenotifyMonitors in interface Variableevent - the event which occurred on the variableContradictionException - if the monitor detects contradiction.public int getTypeAndKind()
Variableint type = var.getTypeAndKind() & Variable.TYPE;To get the KIND of a variable:
int kind = var.getTypeAndKind() & Variable.KIND;To check a specific type or kind of a variable:
boolean isVar = (var.getTypeAndKind() & Variable.VAR) !=0;
boolean isInt = (var.getTypeAndKind() & Variable.INT) !=0;
getTypeAndKind in interface VariableCopyright © 2018. All rights reserved.