Skip to content

Commit

Permalink
[docs] fix bounds in big-M examples of tips_and_tricks.jl (#3721)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Apr 2, 2024
1 parent af30cde commit 617f961
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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, 0 <= x[1:2] <= 10)
@variable(model, x[1:2] <= 10)
@variable(model, y[1:2], Bin)
M = 100
@constraint(model, x[1] <= 1 + M * y[1])
Expand Down Expand Up @@ -255,20 +255,20 @@ model = Model();
# ### Trick 2

# If the solver doesn't support indicator constraints and the variables do not
# have a finite domain, you an use the big-M trick.
# have a finite domain, you can use the big-M trick.

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

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

0 comments on commit 617f961

Please sign in to comment.