rmae19
rmae19

Reputation: 77

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

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.

Upvotes: 4

Views: 173

Answers (1)

Bogumił Kamiński
Bogumił Kamiński

Reputation: 69879

Write:

@variable(mod, x, Bin)

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

Upvotes: 5

Related Questions