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

Error in chap1 script.jl for current stable julia #4

Closed
MaxPowerWasTaken opened this issue Jan 7, 2020 · 4 comments
Closed

Error in chap1 script.jl for current stable julia #4

MaxPowerWasTaken opened this issue Jan 7, 2020 · 4 comments

Comments

@MaxPowerWasTaken
Copy link

Running the first two lines of script.jl in Chapter 1:

using JuMP, GLPK
m = Model(with_optimizer(GLPK.Optimizer))

I get the following error:

ERROR: MethodError: no method matching supports_default_copy_to(::GLPK.Optimizer, ::Bool)
Closest candidates are:
  supports_default_copy_to(::MathOptInterface.Utilities.AbstractModel, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/model.jl:693
  supports_default_copy_to(::MathOptInterface.Utilities.MockOptimizer, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/mockoptimizer.jl:521
  supports_default_copy_to(::MathOptInterface.Utilities.CachingOptimizer, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/cachingoptimizer.jl:165
  ...
Stacktrace:
 [1] #set_optimizer#77(::Bool, ::typeof(set_optimizer), ::Model, ::OptimizerFactory) at /home/mepstein/.julia/packages/JuMP/MsUSY/src/optimizer_interface.jl:43
 [2] #Model#7 at ./none:0 [inlined]
 [3] Model(::OptimizerFactory) at /home/mepstein/.julia/packages/JuMP/MsUSY/src/JuMP.jl:193
 [4] top-level scope at REPL[2]:1

I'm using the current stable julia (1.3.1). I know the book says it was tested on julia 1.1. Should I expect things to not work with julia 1.3? I'm new to Julia so apologies if I've done something unrelated incorrectly.

@chkwon
Copy link
Owner

chkwon commented Jan 7, 2020

I just tested with julia 1.3 and

    Status `~/.julia/environments/v1.3/Project.toml`
  [60bf3e95] GLPK v0.12.1
  [4076af6c] JuMP v0.20.1

It works fine in my machine (macOS)

julia> using JuMP, GLPK

julia> m = Model(with_optimizer(GLPK.Optimizer))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: GLPK

Try ] up

@chkwon chkwon closed this as completed Jan 7, 2020
@MaxPowerWasTaken
Copy link
Author

Thanks for the quick check. Weird. My versions are:

Julia: 1.3.1 (latest stable)
"GLPK" => v"0.12.0"
"JuMP" => v"0.20.1"

@MaxPowerWasTaken
Copy link
Author

MaxPowerWasTaken commented Jan 7, 2020

Ok after running ] up (which you've just taught me about, thanks!) my GLPK was upgraded to 12.1. Now I get the output you posted above.Thanks again!

@chkwon
Copy link
Owner

chkwon commented Jan 8, 2020

Glad it worked!

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

No branches or pull requests

2 participants