# Performance issues JuMP, GLPK

**URL:** <https://discourse.julialang.org/t/performance-issues-jump-glpk/64971>\
**Category:** Optimization (Mathematical)\
**Created:** [July 20, 2021, 8:53am UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971 "2021-07-20T08:53:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annette\_F](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/annette_f/32/26616_2.png) [@Annette\_F](https://discourse.julialang.org/u/Annette_F)\
**Post date:** [July 20, 2021, 8:53am UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971/1 "2021-07-20T08:53:58Z")

</div>

Goodmorning,

I have created the following MIP which I assumed is small and would only take seconds to built and solve.  
I’ve been working with CPLEX/Gurobi quite a lot, just not in combination with Julia, so I expected this to be a quick build, even over the input of size 3000.

Note only did I run out of memory on my laptop ( 10 GB ), on Sagemaker ( 64GB ) it takes several minutes to execute the MIP. ( Note that optimize should be solved quickly as no constraint has an actual impact on the objective, and the variables are bounded )

Am I doing something wrong? Does anyone disagree with my expectation that it should take seconds only?  
I need to know what I can expect from Julia as the MIPs I’m planning to build will get a whole lot bigger.

```julia
using JuMP
using GLPK 
using BenchmarkTools

function GetMaxCliques3( dims )
    clique_model = Model(GLPK.Optimizer; bridge_constraints = false)

    # variable declaration
    @variable(clique_model, maxclique[o in dims], Bin )
    @variable(clique_model, assignordertoclique[o in dims , c in dims], Bin )

    @constraint( clique_model, mustassign[o in dims], assignordertoclique[o, o] == 1 );
    
    @objective(clique_model, Max, sum( maxclique[o] for o in dims ) )
   
end

```

I read something about pre-compiling time and such, so in a separate cell I execute

```julia
dims = [(i) for i = 1:3000]
@btime GetMaxCliques3( dims )

```

The output is:

```julia
Objective is: 3000.0
Objective is: 3000.0
Objective is: 3000.0
Objective is: 3000.0
  333.248 s (90104757 allocations: 7.31 GiB)

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 20, 2021, 9:19am UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971/2 "2021-07-20T09:19:51Z")

</div>

9,000,000 variables seems like a lot? Especially for GLPK. It’s not as efficient as Gurobi or CPLEX. What if you try Cbc?

---

<div class="post-metadata">

**Author:** ![Annette\_F](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/annette_f/32/26616_2.png) [@Annette\_F](https://discourse.julialang.org/u/Annette_F)\
**Post date:** [July 20, 2021, 9:44am UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971/3 "2021-07-20T09:44:40Z")

</div>

That’s more like it; 16 seconds. Thank you!

---

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [July 20, 2021, 11:04am UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971/4 "2021-07-20T11:04:39Z")

</div>

CBC much faster than GLPK? 😀 Could you please provide more results for future reference?

---

<div class="post-metadata">

**Author:** ![Annette\_F](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/annette_f/32/26616_2.png) [@Annette\_F](https://discourse.julialang.org/u/Annette_F)\
**Post date:** [July 20, 2021, 1:20pm UTC](https://discourse.julialang.org/t/performance-issues-jump-glpk/64971/5 "2021-07-20T13:20:12Z")

</div>

Maybe, could you specific as to what you are looking for?  
Also, the small program that makes the difference is in the top-post; feel free to test and collect results yourself 🙂
