How to specify a variable in JuMP that can only be 0 or 1?

Viewed 65

What is the syntax for specifying a variable in a JuMP optimization problem that can only be 0 or 1?

I am using the following code:

@variable(mod, X == 1 || 0)

but it is not working.

1 Answers

Write:

@variable(mod, x, Bin)

You might also want to checkout the the documentation for more examples.

Related