clpfd - Prolog arithmetic -
if had following swi prolog queries , answers
[a,b,c] ins 1..3, a#= b + c.
and needed select below incorrect:
a in 2..3, b in 1..3, c in 1..3.
would correct in thinking in 2..3 not possible in no case can = 3?
actually, constraint does, reduce domains of b , c.
since sum must in range 1..3
, , both have range 1..3
. must assume values in range 1..2
.
then a in 2..3
it's right answer there.
Comments
Post a Comment