[ Term Manipulation | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

set_var_bounds(?Var, +Lower, +Upper)

Impose bounds on a numeric variable in a generic way
Var
Variable or number.
Lower
A number.
Upper
A number.

Description

This predicate is intended to be used on attributed variables that have a numeric domain. The bound information is distributed to the variable's attributes via their set_bounds-handlers. Only existing attributes are involved, no new attributes are created!

The bounds can be given as any numeric type, the set_bounds handlers are expected to interpret them appropriately.

Modes and Determinism

Fail Conditions

Fails if imposing the bounds results in an empty domain

Exceptions

(5) type error
Var is not a variable or number

Examples

    [eclipse 1]: lib(fd), lib(ic).
    yes.

    % update both attributes:
    [eclipse 2]: ic:(X::3.0..9.0), fd:(X::1..7), set_var_bounds(X, 5, 6.5).
    X = X{ic : 5.0..6.5, fd:[5, 6]}
    yes.

    % no attribute - no effect:
    [eclipse 13]: set_var_bounds(X, 5, 6.5).
    X = X
    yes.

    [eclipse 15]: set_var_bounds(0, 5, 6.5).
    no (more) solution.

    [eclipse 14]: set_var_bounds(a, 3,7).
    type error in set_var_bounds(a, 3, 7)

See Also

get_var_bounds / 3