I have the following CLP(FD) query:
?- use_module(library(clpfd)).
?- [I,N,M,J] ins -2147483648..2147483647,
I - 3*N #= X, X in 1..2,
I - 5*M #= Y, Y in 1..4,
I - 15*J #= 0.
In SWI-Prolog already when posing the query without a label/1 goal, the interpreter practically hangs. I don't expect it to terminate in a short time.
How can I modify the query, some reordering etc.. so that it delivers the expected answer "false"?
Bye
P.S.: After pressing ^C and t after some while, I see that the CLP(FD) system is still busy.
Very easy:
First, replace I by J*15 ; and put the big domains last:
?- 15*J - 3*N #= X, X in 1..2,
15*J - 5*M #= Y, Y in 1..4,
I #= 15*J,
[I,N,M,J] ins -2147483648..2147483647.
false.
Factors as above are not always detected, and propagation as such is weak since it could easily blow up the representation of the domain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With