Re: FD Solver - incorrect behaviour
Daniel Diaz <[email protected]>
| Newsgroups | gmane.comp.gnu.prolog.bugs |
|---|---|
| Message-ID | <[email protected]> |
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