Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] fix benders_decomposition.jl #3532

Merged
merged 6 commits into from
Oct 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/tutorials/algorithms/benders_decomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ y_optimal = optimal_ret.y
lazy_model = Model(GLPK.Optimizer)
@variable(lazy_model, x[1:dim_x] >= 0, Int)
@variable(lazy_model, θ >= M)
@objective(lazy_model, Min, θ)
@objective(lazy_model, Min, c_1' * x + θ)
print(lazy_model)

# What differs is that we write a callback function instead of a loop:
Expand All @@ -266,7 +266,7 @@ function my_callback(cb_data)
return
end
cut = @build_constraint(θ >= ret.obj + -ret.π' * A_1 * (x .- x_k))
MOI.submit(model, MOI.LazyConstraint(cb_data), cut)
MOI.submit(lazy_model, MOI.LazyConstraint(cb_data), cut)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should look at why this didn't error. It should have...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
It has indeed, after changing GLPK to Gurobi. (I have not installed GLPK)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this might be an issue with GLPK, not with JuMP. Thanks for looking.

return
end

Expand Down
Loading