UndefVarError: ClpSolver not defined

Hi, I am written a small code to elaborate the error which I am facing:

using JuMP
using Cbc
m = Model(solver = ClpSolver())
@variable(m, 0 <= x <= 2 )
@variable(m, 0 <= y <= 30 )
@objective(m, Max, 5x + 3y )
@constraint(m, 1x + 5y <= 3.0 )
print(m)
status = solve(m)

I remember that I have ran this code perfectly fine a week back, but suddenly, I am facing the following error:

LoadError: e[91mUndefVarError: ClpSolver not definede[39m

while loading C:\Users\rajatsanyal\Desktop\JULIA Coding\Practice\test_code2.jl, in expression starting on line 3

include_string(::String, ::String) at loading.jl:522

include_string(::Module, ::String, ::String) at Compat.jl:84

(::Atom.##112#116{String,String})() at eval.jl:109

withpath(::Atom.##112#116{String,String}, ::String) at utils.jl:30

withpath(::Function, ::String) at eval.jl:38

hideprompt(::Atom.##111#115{String,String}) at repl.jl:67

macro expansion at eval.jl:106 [inlined]

(::Atom.##110#114{Dict{String,Any}})() at task.jl:80

Any idea how to resolve the issue. Thanks for your help in advance.

using Clp?

2 Likes

Thanks. Sorry, it was a naive mistake. :expressionless:

Hi. In the main code, I am getting the following error message:

LoadError: e[91mReadOnlyMemoryError()e[39m

while loading C:\Users\rajatsanyal\Desktop\JULIA Coding\Coplanning.jl, in expression starting on line 411

optimize!(::Cbc.CbcMathProgSolverInterface.CbcMathProgModel) at CbcSolverInterface.jl:152

Any suggestion why am I getting a ROM error message?

Hey. Please read Please read: make it easier to help you, especially the points regarding a minimal working example and version numbers.

1 Like

Sorry for the delayed response. It is very difficult to share a minimal working example. Instead, I can explain what I am trying to solve.

I am trying to solve a mixed integer linear programming problem. The optimization model has the following features:

Minimization problem with:

  • 472362 linear constraints
  • 246318 variables: 70590 binary

Solver is Cbc.

I am using Julia 1.1.0 with Atom 1.34.0. The machine configuration is as follows:

Processor: Intel Xeon, 2 processor at 2.1 GHz,
RAM: 128 GB.

The error that I am getting, is as follows:

ReadOnlyMemoryError()
in top-level scope at [base\none]
in solve at [JuMP\PbnIJ\src\solvers.jl:150]
in #solve#120 at [JuMP\PbnIJ\src\solvers.jl:175]
in optimize! at [Cbc\E1k0O\src\MPB_wrapper.jl:153]
in solve at [Cbc\E1k0O\src\CbcCInterface.jl:68]

For the line numbers to make sense: what are the version numbers for JuMP and Cbc?

I have the following packages installed in my system:

“Juno” => v"0.5.4"
“Conda” => v"1.1.1"
“XLSX” => v"0.4.4"
“ExcelReaders” => v"0.10.2"
“Cbc” => v"0.5.0"
“Clp” => v"0.6.1"
“Atom” => v"0.7.14"
“JuMP” => v"0.18.5"

1 Like

Could you try using Pkg; pkg"add https://github.com/tkoolen/Cbc.jl#tk/gc-preserve" at the REPL and run your code again?

1 Like

Thanks. I will try and let you know about it.