Last active
October 18, 2019 01:01
-
-
Save chkwon/2e003c0182e9c45e69db9cd210ec9872 to your computer and use it in GitHub Desktop.
Shadow Price for LP problems in Julia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JuMP, GLPK | |
m = Model(with_optimizer(GLPK.Optimizer)) | |
@variable(m, x1 >= 0) | |
@variable(m, x2 >= 0) | |
@objective(m, Max, 3x1 + 5x2) | |
@constraint(m, c1, x1 <= 4) | |
@constraint(m, c2, 2x2 <= 12) | |
@constraint(m, c3, 3x1 + 2x2 <= 18) | |
optimize!(m) | |
@show value(x1), value(x2) | |
@show shadow_price(c1), shadow_price(c2), shadow_price(c3) | |
@show objective_value(m) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment