[ library(range) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

upb(?Var, ++Bound)

Constrain Var to be less or equal to upper bound Bound.
Var
Variable or number
Bound
Upper bound (number)

Calling Modes

Description

Constrain the variable to be less or equal to the specified upper bound. A bound update on a variable may fail (when the update empties the domain), succeed (possibly updating the variable's bounds), or instantiate the variable (in case the domain get restricted to a singleton value). Note that if the variable's type is integer, its bounds will always be adjusted to integral values.

Important hint: this predicate may trigger waking when applied to existing variables. In this case, schedule_suspensions/1 will be executed by the predicate, so the goals will be scheduled for waking, but not actually executed. The caller therefore has to call wake/0 (the woken goal scheduler) at an appropriate point in the subsequent execution.

Examples

[eclipse 2]: X::0.0..9.5, lwb(X,4.5).
X = X{4.5 .. 9.5}
yes.
[eclipse 3]: X::0.0..9.5, lwb(X,4.5), integers([X]).
X = X{5 .. 9}
yes.
[eclipse 4]: X::0.0..9.5, lwb(X,4.5), integers([X]), upb(X,5.9).
X = 5
yes.
[eclipse 5]: X::0.0..9.5, lwb(X,4.5), upb(X,4.3).
no (more) solution.

See Also

lwb / 2