Hello,
With the following code, strangePower1(A,B) gives one solution, where the other
versions give two:
strangePower1(A,B) :-
fd_domain([A,B],0,5),
(A-B)**2 #> 16, % <-------
fd_labeling([A,B]).
strangePower2(A,B) :-
fd_domain([A,B],0,5),
(A-B)*(A-B) #> 16, % <-------
fd_labeling([A,B]).
strangePower3(A,B) :-
fd_domain([A,B],0,5),
A**2 -2*A*B +B**2 #> 16, % <-------
fd_labeling([A,B]).
| ?- strangePower2(A,B).
A = 0 B = 5 ? a
A = 5 B = 0
(15 ms) no
| ?- strangePower1(A,B).
A = 5 B = 0
yes
Can you explain why? Do you think this difference is reasonable from the
programmer's point of view?
Observed in gprolog-1.4.0, both in Win32 and Linux32.
Best regards.
_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog