Re: [eclipse-clp-users] Labelling real variables

From: Joachim Schimpf <>
Date: Mon, 08 Apr 2013 00:35:19 +0100
On 06/04/2013 15:49, Matthew Skala wrote:
> Does lib(ic) or its relatives provide any labelling routine capable of
> instantiating real-number variables in a way that will stop bb_min from
> producing the "search did not instantiate cost variable" error?  The
> search/6, labeling/1, and indomain/{1,2} predicates only seem to work on
> integers. I can narrow down the domains of real variables with
> locate/{2,3,4}, but the only really simple way I've found to keep bb_min
> happy is to do locate to my desired level of precision, then call
> get_median/2 on my cost variable and set the cost equal to the median
> value.

If you set the variable to a float (like the median of the interval),
then you claim a precision that was not implied by the solver, and
as a result, your constraints may wake up and fail.

The technically correct way would be to instantiate the interval
variable to a "bounded real" constant instead, like so

     get_var_bounds(X, XL, XH),
     breal_from_bounds(XL, XH, X)

This turns the variable X into a constant with the same bounds.
The semantic difference between the two is subtle: for an interval
variable, there _may_ be a solution within the bounds (and these bounds
may be tightened further), while a breal constant means that there _is_
a value, it's just not precisely known (and will not be known any more

Because instantiation to a breal "freezes" the imprecision, you should
do this as late as possible in your computation, otherwise you forego
possible further bound reductions due to constraint propagation.

bb_min should correctly deal with breals.

-- Joachim
Received on Sun Apr 07 2013 - 23:36:19 CEST

This archive was generated by hypermail 2.2.0 : Sat Apr 13 2013 - 18:13:15 CEST