Strange difference in FD between E*E and E**2
Fred Bapst <[email protected]>
| Newsgroups | gmane.comp.gnu.prolog.general |
|---|---|
| Message-ID | <[email protected]> |
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.