Package org.chocosolver.solver.variables
Interface RealVar
-
- All Superinterfaces:
CArExpression,Comparable<Variable>,Identity,Variable
- All Known Implementing Classes:
FixedRealVarImpl,RealVarImpl,RealView
public interface RealVar extends Variable, CArExpression
An interface to declare variable for continuous constraints (solved using IBEX).- Since:
- 18/07/12
- Author:
- Charles Prud'homme
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.chocosolver.solver.expression.continuous.arithmetic.CArExpression
CArExpression.Operator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description doublegetLB()Retrieves the lower bound of the variabledoublegetPrecision()doublegetUB()Retrieves the upper bound of the variabledefault RealVarrealVar(double p)booleanupdateBounds(double lowerbound, double upperbound, ICause cause)Updates the bounds of the domain ofthistovalue.booleanupdateLowerBound(double value, ICause cause)Updates the lower bound of the domain ofthistovalue.booleanupdateUpperBound(double value, ICause cause)Updates the upper bound of the domain ofthistovalue.-
Methods inherited from interface org.chocosolver.solver.expression.continuous.arithmetic.CArExpression
abs, 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, tanh
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.chocosolver.solver.variables.Variable
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, createDelta, getCause, getDelta, getDindex, getEnvironment, getEvtScheduler, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getTypeAndKind, getViews, isAConstant, isInstantiated, link, notifyMonitors, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
-
-
-
-
Method Detail
-
getLB
double getLB()
Retrieves the lower bound of the variable- Returns:
- the lower bound
-
getUB
double getUB()
Retrieves the upper bound of the variable- Returns:
- the upper bound
-
updateLowerBound
boolean updateLowerBound(double value, ICause cause) throws ContradictionExceptionUpdates the lower bound of the domain ofthistovalue. The instruction comes frompropagator.- If
valueis smaller than the lower bound of the domain, nothing is done and the return value isfalse, - if updating the lower bound to
valueleads to a dead-end (domain wipe-out), aContradictionExceptionis thrown, - otherwise, if updating the lower bound to
valuecan be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value istrue
- Parameters:
value- new lower bound (included)cause- updating releaser- Returns:
- true if the lower bound has been updated, false otherwise
- Throws:
ContradictionException- if the domain become empty due to this action
- If
-
updateUpperBound
boolean updateUpperBound(double value, ICause cause) throws ContradictionExceptionUpdates the upper bound of the domain ofthistovalue. The instruction comes frompropagator.- If
valueis greater than the upper bound of the domain, nothing is done and the return value isfalse, - if updating the upper bound to
valueleads to a dead-end (domain wipe-out), aContradictionExceptionis thrown, - otherwise, if updating the upper bound to
valuecan be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value istrue
- Parameters:
value- new upper bound (included)cause- update releaser- Returns:
- true if the upper bound has been updated, false otherwise
- Throws:
ContradictionException- if the domain become empty due to this action
- If
-
updateBounds
boolean updateBounds(double lowerbound, double upperbound, ICause cause) throws ContradictionExceptionUpdates the bounds of the domain ofthistovalue. The instruction comes frompropagator.- If the interval defined by [
lowerbound,upperbound] includes the domain of this, nothing is done and the return value isfalse, - if updating the domain leads to a dead-end (domain wipe-out),
a
ContradictionExceptionis thrown, - otherwise, if updating the domain be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is
true
- Parameters:
lowerbound- new lower bound (included)upperbound- new upper bound (included)cause- update releaser- Returns:
- true if the upper bound has been updated, false otherwise
- Throws:
ContradictionException- if the domain become empty due to this action
- If the interval defined by [
-
getPrecision
double getPrecision()
-
realVar
default RealVar realVar(double p)
- Specified by:
realVarin interfaceCArExpression- Parameters:
p- precision of the variable to return- Returns:
- the arithmetic expression as an
RealVar. If necessary, it creates intermediary variable and posts intermediary constraints
-
-