I tried to solve an integer-linear optimization problem but failed. I reduced the failed example to the following:
FindMaximum[{x + y, Element[x , {0, 1}], Element[y , {0, 1}]}, {x, y}]
I got the following error:
FindMaximum::elemc: Unable to resolve the domain or region membership condition x\[Element]{0,1}.
I get the same error when using NMaximize
instead of FindMaximum
.
What am I doing wrong?
NMaximize[{x + y, 0<=x<=1,0<=y<=1}, {x, y}, Integers]
work? $\endgroup$FindMaximum[{x + y,x<=1,y<=1, Element[{x,y},Integers]}, {x, y}]
$\endgroup$FindMaximum
function page hint why OP's command does not work. Although, I might be wrong... $\endgroup${1,2}
is not a set, but a list. $\endgroup$