Message Boards Message Boards

Set a variable to Binary?


I want to optimize a function, with a constraint that requires a variable to be 0 or 1, not other value. How do I do that?

Depending on how I do this it may converge or not.


POSTED BY: Juan David
5 months ago

Hard to respond with no code showing an example. A guess: if the variable is x then add constraints 0<=x<=1 and Element[x,Integers].

POSTED BY: Daniel Lichtblau
5 months ago

Group Abstract Group Abstract