# UndefVarError: ClpSolver not defined

**URL:** <https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, optimization\
**Created:** [January 10, 2019, 3:34pm UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481 "2019-01-10T15:34:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 10, 2019, 3:34pm UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/1 "2019-01-10T15:34:15Z")

</div>

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

```julia
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.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 10, 2019, 4:00pm UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/2 "2019-01-10T16:00:37Z")

</div>

`using Clp`?

---

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 11, 2019, 7:40am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/3 "2019-01-11T07:40:52Z")

</div>

Thanks. Sorry, it was a naive mistake. 😑

---

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 11, 2019, 4:38pm UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/4 "2019-01-11T16:38:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 11, 2019, 5:04pm UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/5 "2019-01-11T17:04:39Z")

</div>

Hey. Please read [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757), especially the points regarding a minimal working example and version numbers.

---

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 31, 2019, 2:34am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/6 "2019-01-31T02:34:39Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 31, 2019, 2:42am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/7 "2019-01-31T02:42:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 31, 2019, 3:11am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/8 "2019-01-31T03:11:03Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 31, 2019, 3:33am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/9 "2019-01-31T03:33:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rajat\_Sanyal](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Post date:** [January 31, 2019, 7:02am UTC](https://discourse.julialang.org/t/undefvarerror-clpsolver-not-defined/19481/10 "2019-01-31T07:02:17Z")

</div>

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