Performance issues JuMP, GLPK


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.

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  ) )

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

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

The output is:

Objective is: 3000.0
Objective is: 3000.0
Objective is: 3000.0
Objective is: 3000.0
  333.248 s (90104757 allocations: 7.31 GiB)
1 Like

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?

1 Like

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

1 Like

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

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 :slight_smile: