How can I make Gurobi solve a binary optimization problem faster?
AnsweredI am trying to solve a large binary optimization problem with thousand of decision variables and both equality and inequality constraints.
I would like to know if there is a "best practise" to set the options of the solver in order to make it converge faster, as now takes days to get to a solution.
The following is the log of an iteration
Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (win64)
CPU model: Intel(R) Xeon(R) CPU E52650 v3 @ 2.30GHz, instruction set [SSE2AVXAVX2]
Thread count: 20 physical cores, 40 logical processors, using up to 20 threads
Optimize a model with 39347 rows, 120782 columns and 180911 nonzeros
Model fingerprint: 0xb34ee1ed
Variable types: 0 continuous, 120782 integer (120782 binary)
Coefficient statistics:
Matrix range [8e02, 1e+00]
Objective range [1e+00, 2e+00]
Bounds range [1e+00, 1e+00]
RHS range [4e+04, 4e+04]
Found heuristic solution: objective 36401.000000
Presolve removed 39347 rows and 120782 columns
Presolve time: 0.20s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 0.28 seconds (0.08 work units)
Thread count was 1 (of 40 available processors)
Solution count 2: 75748 36401
Optimal solution found (tolerance 1.00e04)
Best objective 7.574800000000e+04, best bound 7.574800000000e+04, gap 0.0000%

Hi Camilla,
It seems that your problem is solved really fast at the presolve phase:
Presolve: All rows and columns removed
And only takes 0.28 seconds.
Did you paste the wrong log?Cheers,
David0 
No, I did not. In fact, this is the strange thing. I noticed that the estimated time is 0.28 seconds, but the algorithm does a lot of iterations with a negligible improvement of the solution found. I tried to look into termination and tolerance parameters but are quite numerous.
0 
I think I understand, the log you provided is repeated many times as you are solving that solving many similar problems using MATLAB?
If so: Are you solving a multiobjective problem with many objectives (or similar)?
 Or, are you using a thirdparty tool or some specific algorithm?
Otherwise, if this is the single log you can see and the problem is only being solved once, where is the log getting stuck? It should take 0.28 seconds that is not an estimate, it is the measured time.
If you can see the log in 0.28 seconds and nothing happens after this, something else is not allowing your program to exit.
You can check this on your side using something like timeit.Cheers,
David0 
Yes, I see this log repeated many times, I am trying to debug the code to understand why, I will look it up the timeit command. Many thanks
0
Please sign in to leave a comment.
Comments
4 comments