Hello Everybody
I’m the clpfd newbie and I try to use it to solve the fraction problem from the YT movie:
I’m using: SWI-Prolog version 8.3.17 (but I think it is not very important)
I want the code to give me the exact solution: X = 7, Y = 3
and I’ve found that the code:
(5*X + 3) * (2*Y+1) #= 38*X, [X,Y] ins 3..8.
prints that answer, but the code:
(5*X + 3) * (2*Y+1) #= 38*X, [X,Y] ins 1..10.
does NOT - it requires the label()
to be added to work this way…
as here:
(5*X + 3) * (2*Y+1) #= 38*X, [X,Y] ins 1..10, label([X,Y]).
and I do not understand, when the label()
is necessary, and when it is optional???
why the first version of my code works ‘out of the box’ and the second doesn’t?
thank you in advance
Tadeusz