bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FD Solver - incorrect behaviour


From: Daniel Diaz
Subject: Re: FD Solver - incorrect behaviour
Date: Wed, 11 Feb 2004 08:24:06 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

Hi Stephen,

you are right this kind of limitation occurs easily with non-linear constraints. It is difficult to find a solution which works in every case. A simple workaround is to slightly modify your source as follows:

bug(L) :-
        L=[P1,P2,P3,P4,P6,P7,P8,P9],
        fd_domain(L,[2,3,5,7]),
%       uncomment the following line and this works correctly
%       P2#=7,
        Z #= 100 * P3 + 10 * P2 + P1,
        P4 * Z #= 1000 * P9 + 100 * P8 + 10 * P7 + P6.

I try to fix things asap :-)


Stephen Meyles wrote:

The following seems to be a bug with the FD solver:

bug(L) :-
        L=[P1,P2,P3,P4,P6,P7,P8,P9],
        fd_domain(L,[2,3,5,7]),
%       uncomment the following line and this works correctly
%       P2#=7,
        P4 * (100 * P3 + 10 * P2 + P1 )
                #= 1000 * P9 + 100 * P8 + 10 * P7 + P6.

With P2 constrained to [2,3,5,7], the predicate returns no.  With it
further constrained to 7 alone, it correctly returns the variable list
suitably constrained.

RH9 Linux (x86, glibc 2.3)
gprolog v1.2.16 (stable) and v1.2.18 (unstable)

Regards

Stephen







reply via email to

[Prev in Thread] Current Thread [Next in Thread]