[eclipse-clp-users] Bug in lex_le/2

From: Chris Mears <chris.mears_at_...269...>
Date: Thu, 10 Feb 2011 16:01:23 +1100
Hi all,

I think there is a small bug in lex_le/2 in ic_global_gac: it doesn't
always enforce GAC.

Here is an example:

?- X = [](A, B, C, D), X #:: 1 .. 5, ic_global_gac : lex_le([A, B],
[C, D]), B = 2, D = 1.
X = [](A{1 .. 5}, 2, C{1 .. 5}, 1)
A = A{1 .. 5}
B = 2
C = C{1 .. 5}
D = 1

The bounds on A and C are wrong; A<C should be enforced and therefore
5 should be deleted from A and 1 deleted from C. (Note that if the
assignments to B and D are made *before* lex_le is imposed, then the
bounds are correct.)

The cause of the problem is that the constraint isn't woken when B and
D are changed. I think the error is in line 969 of
generic_global_gac.ecl:

            Upper is fix(min(B,N))-1, % convert to integer required

... which I think should be:

            Upper is fix(min(B-1,N)), % convert to integer required

In my very limited testing, this fixes the problem.

Chris
Received on Thu Feb 10 2011 - 05:02:14 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST