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

Simple model run issues #129

Closed
nemoincognito opened this issue Sep 22, 2022 · 5 comments
Closed

Simple model run issues #129

nemoincognito opened this issue Sep 22, 2022 · 5 comments

Comments

@nemoincognito
Copy link

nemoincognito commented Sep 22, 2022

I am running a very mickey mouse model using HiGHS and JuMP:

using JuMP, HiGHS
m = Model(HiGHS.Optimizer)
set_optimizer_attribute(m, "presolve","on")
set_optimizer_attribute(m, "time_limit", 60.0)
set_optimizer_attribute(m, "solver", "simplex")
@variable(m, 0<= x1 <= 10)
@variable(m, x2>= 0)
@variable(m, x3>=0)
@objective(m, Max, x1 + 2x2 + 5x3)
@constraint(m, constraint1, -x1 + x2 + 3x3 <= -5)
@constraint(m, constraint2, x1+ 3x2 -7x3 <= 10)
print(m)
solve(m)
println("Optimal Solutions:")
println("x1 = ", getvalue(x1))
println("x2 = ", getvalue(x2))
println("x3 = ", getvalue(x3))

println("Dual Variables")
println("dual1 = ", getdual(constraint1))
println("dual2 = ", getdual(constraint2))

But keep getting the error below:

UndefVarError: solve not defined

Any suggestions as to what might be going on here? Running Julia in VSCode, installation of JuMP and HiGHS packages went fine.

@blegat
Copy link
Member

blegat commented Sep 22, 2022

The functions solve, getvalue and getdual belong to old versions of JuMP. Make sure you get the documentation by going to https://jump.dev/ and then clicking on "Documentation"

@odow
Copy link
Member

odow commented Sep 22, 2022

Closing because this is not a bug in JuMP or HiGHS.

The documentation is here: https://jump.dev/JuMP.jl/stable/

In particular, you might want to read https://jump.dev/JuMP.jl/stable/manual/solutions/.

If you have more questions, please post on the community forum: https://discourse.julialang.org

@odow odow closed this as completed Sep 22, 2022
@nemoincognito
Copy link
Author

Many thanks, looks like the Julia Programming for OR book is now very out of date!

@odow
Copy link
Member

odow commented Sep 25, 2022

looks like the Julia Programming for OR book is now very out of date!

Did you read the second edition? Can you point to which examples/chapters are out of date?

cc @chkwon

@chkwon
Copy link

chkwon commented Sep 26, 2022

@nemoincognito You can read the second edition for free here:

http://juliabook.chkwon.net

Please let me know if you find any code or content that needs to be updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants