I am trying to solve an optimization problem, a simplified version of which is as follows:
x = Table[Symbol["x" <> ToString[i]], {i, 7}];
A = {3, 2, 5, 1, 7, 9, 6};
Minimize[{A.x,
And @@ Thread[0 <= x <= 1] &&
Plus @@ x == 3 &&
x \[Element] Integers &&
x != {1, 1, 0, 1, 0, 0, 0}
}, x]
Here, the sought-after solution is for x
. The issue is that the solution when all but the last constraint (x != {1, 1, 0, 1, 0, 0, 0}
) are used is exactly {1, 1, 0, 1, 0, 0, 0}
. When I introduce the last constraint, there is no effect - I still obtain the same solution, although that constraint should remove that particular solution and output the next best one. If I replace the last constraint with x == {0, 1, 1, 1, 0, 0, 0}
, then the output solution is exactly {0, 1, 1, 1, 0, 0, 0}
, so the comparison seems to be evaluated, but for some reason, the inequality given by x != {1, 1, 0, 1, 0, 0, 0}
does not evaluate to False
, although it should. Any thoughts on this would be appreciated.sov