[ The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

library(range)

Allow variables to range over integer or real intervals.

Predicates

?Vars #:: ++Lo..Hi
Constrain Vars to the integer interval between Lo and Hi.
?Vars $:: ++Lo..Hi
Constrain Vars to the real interval between Lo and Hi.
?Vars :: ++Lo..Hi
Constrain Vars to the interval between Lo and Hi.
compare_instances_range(-Res, ?TermL, ?TermR)
Compare instance handler for the range attribute.
copy_term_range(?Meta, ?Copy)
copy_term handler for range attribute.
delayed_goals_number_range(?Meta, -Number)
delayed_goals_number handler for the range attribute.
int_tolerance(-Tol)
Get the integer tolerance value.
integers(?Vars)
Vars' domain is the integer numbers.
is_range(?Term)
Succeeds if Term is a ranged variable.
lwb(?Var, ++Bound)
Constrain Var to be greater or equal to lower bound Bound.
print_range(-Var, -Range)
Returns the ranged variable Var's range.
range(?, ?, ?, ?)
No description available
range_msg(?Var1, ?Var2, ?MSG)
Computes the most specific generalisation of the ranges in Var1 and Var2.
range_over(?, ?, ?, ?)
No description available
reals(?Vars)
Vars' domain is the real numbers.
set_default_range(++Lo, ++Hi)
Set the default range to Lo..Hi.
set_int_tolerance(++Tol)
Set the integer tolerance value.
set_range_bounds(?Var, ++Lo, ++Hi)
set_bounds handler for range attribute.
suspensions_range(?Meta, ?SuspLists, -SuspListsTail)
Handler to retrieve suspensions from the range attribute
test_unify_range(+Term, ?Attribute)
test_unify handler for range attribute.
unify_range(+Term, ?Attribute)
Unification handler for range attribute.
upb(?Var, ++Bound)
Constrain Var to be less or equal to upper bound Bound.
var_range(?Var, -Lo, -Up)
Retrieve the current range of a variable (or number).
var_type(?Var, -Type)
Retrieve the type of a variable.

Structures

struct range(type, lo, hi, wake_lo, wake_hi)
No description available

Other Exports

export op(700, xfx, [::, $::, #::])

Description

This library implements variables that range over integer or real intervals. It is meant to be used as a common basis for arithmetic constraint solvers, and it can serve as a mechanism to make such solvers communicate.

HANDLERS

The library installs the following handlers (cf. ECLiPSe User Manual) in order to implement the semantics of ranged variables:

unify:
Unification between two variables amounts to intersecting their ranges and taking the more restrictive type as the result type. If the intersection is empty, the unification fails. Unifying a variable with a number involves a check whether the number is within the variable's range and of the proper type, otherwise failure occurs.
test_unify:
Like unify.
compare_instances:
A range variable is an instance of another when its range is subsumed by the other range.
copy_term:
Range and type are copied, delayed goals are not.
delayed_goals, delayed_goals_number:
Considers the goals in the two attached suspension lists.
print:
Ranges are printed using print_range/2.
Due to the handlers, Unification and instance test take the ranges into account:
  [eclipse 6]: X::0.0..5.5, Y::3..8, X=Y.
  X = X{3 .. 5}
  Y = X{3 .. 5}
  yes.
  [eclipse 8]: X::0.0..5.5, Y::3..8, instance(X,Y).
  no (more) solution.
  [eclipse 9]: X::0.0..5.5, Y::3..5, instance(Y,X).
  Y = Y{3 .. 5}
  X = X{0.0 .. 5.5}
  yes.

ATTRIBUTE STRUCTURE

Ranged variables are implemented as attributed variables. The attribute contains the following fields:

type:
specifies the variable type, either integer or real.
lo:
the smallest value the variable can assume
hi:
the largest value the variable can assume
wake_lo:
list of goals to be woken on lower bound change
wake_hi:
list of goals to be woken on upper bound change

About


Generated from range.eci on Sat Aug 7 01:44:30 2004