Given the following sample of code:
example(Ls) :-
Ls = [X,Y],
Ls ins 1..2,
Cost #= max((X #= 1)*3 + (Y #= 1)*5,
(X #= 2)*3 + (Y #= 2)*5),
labeling([minimize(Cost)], Ls).
The idea is to find the assignment to variables of Ls that minimizes Cost (in this simple example, it would be either X=1 and Y=2, or X=2 and Y=1).
I am trying to use the fact that the constraint #=/2 is reifiable, which means reflecting their truth values into Boolean values represented by the integers 0 and 1. (taken from the manual http://www.swi-prolog.org/man/clpfd.html).
However, it doesn't work. I get the following error:
ERROR: Domain error: `clpfd_expression' expected, found `_G3154#=1'
What would be an equivalent, correct version?