Skip to content

Commit

Permalink
[docs] add bounds to big-M examples (#3720)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Apr 1, 2024
1 parent 177d213 commit 374c614
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/src/tutorials/linear/tips_and_tricks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ model = Model();
# **Example** Either $x_1 \leq 1$ or $x_2 \leq 2$.

model = Model();
@variable(model, x[1:2])
@variable(model, 0 <= x[1:2] <= 10)
@variable(model, y[1:2], Bin)
M = 100
@constraint(model, x[1] <= 1 + M * y[1])
Expand Down Expand Up @@ -260,15 +260,15 @@ model = Model();
# **Example** $x_1 + x_2 \leq 1$ if $z = 1$.

model = Model();
@variable(model, x[1:2])
@variable(model, 0 <= x[1:2] <= 10)
@variable(model, z, Bin)
M = 100
@constraint(model, sum(x) <= 1 + M * (1 - z))

# **Example** $x_1 + x_2 \leq 1$ if $z = 0$.

model = Model();
@variable(model, x[1:2])
@variable(model, 0 <= x[1:2] <= 10)
@variable(model, z, Bin)
M = 100
@constraint(model, sum(x) <= 1 + M * z)
Expand Down

0 comments on commit 374c614

Please sign in to comment.