Hello, I am preparing a short tutorial on how to use Julia for Control Systems and I was using Julia 1.5 and it was working ok. Then I decided to test version 1.6 to see if it would make it load faster (considering that most people will be using Julia for the first time it would be nice if it installs the packages and loads them in a reasonable amount of time.)
Problem is, once I tried to use the new version it did install and load the packages faster but it then got stuck in the optimize!(m)
line. Initially I was using Ipopt but I get the same problem with GLPK, so I got a minimal example of the bug (is it a bug?) that I am facing. It seems to be caused by the combination of packages I am using, because if I only load JuMP and GLPK it works very fast.
using Pkg
Pkg.activate("temp_env1")
@time begin
Pkg.add(["ControlSystems","ControlSystemIdentification","JuMP",
"GLPK","Ipopt","DifferentialEquations","Plots",
"SymPy","NLsolve","ForwardDiff","LaTeXStrings"])
end
@time begin
using ControlSystems
using ControlSystemIdentification
using JuMP
using GLPK
using Ipopt
using DifferentialEquations
using Plots
using SymPy
using LinearAlgebra
using NLsolve
using ForwardDiff
using LaTeXStrings
end
#m = Model(Ipopt.Optimizer);
m = Model(GLPK.Optimizer);
JuMP.@variable(m,m_x);
optimize!(m)
With the help of some redditors (https://www.reddit.com/r/Julia/comments/ml65zj/julia_16_gets_stuck_optimizing_with_jump_due_to/) I figured the workaround shown below. I loaded ControlSystemIdentification after running an optimization once and got it to run correctly, but I have no idea if this is a problem with JuMP or ControlSystemIdentification and I don’t know how to debug that on my own.
using Pkg
Pkg.activate("temp_env2")
@time begin Pkg.add(["ControlSystems","ControlSystemIdentification","JuMP","GLPK","Ipopt","DifferentialEquations","Plots","SymPy","NLsolve","ForwardDiff","LaTeXStrings"])
end
@time begin
using ControlSystems
using JuMP
using GLPK
using Ipopt
using DifferentialEquations
using Plots
using SymPy
using LinearAlgebra
using NLsolve
using ForwardDiff
using LaTeXStrings
end
#m = Model(Ipopt.Optimizer);
m = Model(GLPK.Optimizer);
JuMP.@variable(m,m_x);
optimize!(m)
using ControlSystemIdentification
m = Model(Ipopt.Optimizer);
#m = Model(GLPK.Optimizer);
JuMP.@variable(m,m_x);
optimize!(m)
My versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, broadwell)
Environment:
JULIA_NUM_THREADS = 6
With packages
Status `~/.julia/environments/v1.6/Project.toml`
[3abffc1c] ControlSystemIdentification v1.6.0
[a6e380b2] ControlSystems v0.9.2
[0c46a032] DifferentialEquations v6.16.0
[f6369f11] ForwardDiff v0.10.17
[60bf3e95] GLPK v0.14.8
[7073ff75] IJulia v1.23.2
[b6b21f68] Ipopt v0.6.5
[4076af6c] JuMP v0.21.6
[b964fa9f] LaTeXStrings v1.2.1
[2774e3e8] NLsolve v4.5.1
[91a5bcdd] Plots v1.11.2
[24249f21] SymPy v1.0.42