Gurobi Parameters
AnsweredHello,
I am running an optimization model for a big case study. I applied three below parameters to increase the solving speed of the model. However, the stopping method MIPGapAbs doesn't work. In other words, the running process will not stop after reaching this gap. It continues till the optimality. Can you please guide me through this problem?
Bests
m.Params.MIPFocus = 2
m.Params.Cuts=2
m.Params.MIPGapAbs=0.03
m.optimize()
-
Hi Monir,
Could you post your log file from the run with these parameters?
Note that MIPGapAbs refers to the absolute difference between the lower and upper bounds. This means that Gurobi should stop once \( |z_{\textrm{upper}} - z_{\textrm{lower}}| < 0.03 \). This is not to be confused with MIPGap, which refers to the relative gap between the two bounds.
Thanks,
Eli
0 -
Hi Eli, thank you for your quick response. Oh, I thought that MIPGapAbs is |MIPGap|. So, I will run the model with MIPGap and let you know about the results.
I have a quick question about these parameters. Is the order of these parameters important? For example, does it make any changes if I set MIPGap first, then the others?
Bests.
Log file:
Changed value of parameter MIPFocus to 2
Prev: 0 Min: 0 Max: 3 Default: 0
Changed value of parameter Cuts to 2
Prev: -1 Min: -1 Max: 3 Default: -1
Changed value of parameter MIPGapAbs to 0.03
Prev: 1e-10 Min: 0.0 Max: 1e+100 Default: 1e-10
Optimize a model with 36488132 rows, 36700601 columns and 47451411 nonzeros
Model has 492693 quadratic constraints
Variable types: 36379 continuous, 36664222 integer (36655752 binary)
Coefficient statistics:
Matrix range [6e-04, 1e+02]
QMatrix range [2e-04, 1e+02]
QLMatrix range [1e-03, 3e+01]
Objective range [1e+00, 2e+01]
Bounds range [1e+00, 1e+02]
RHS range [1e+00, 5e+04]
QRHS range [1e+00, 6e+04]
Presolve removed 875 rows and 866 columns (presolve time = 18s) ...
Presolve removed 35721625 rows and 9275 columns (presolve time = 23s) ...
Presolve removed 35721625 rows and 13818 columns (presolve time = 26s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 36s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 40s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 47s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 52s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 57s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 62s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 67s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 70s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 77s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 82s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 87s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 92s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 97s) ...
Presolve removed 35722491 rows and 14684 columns (presolve time = 100s) ...
Presolve removed 35723604 rows and 15797 columns (presolve time = 105s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 110s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 115s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 120s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 125s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 130s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 135s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 140s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 145s) ...
Presolve removed 35724037 rows and 15797 columns (presolve time = 150s) ...
Presolve removed 35732086 rows and 35607644 columns (presolve time = 156s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 160s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 166s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 170s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 175s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 180s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 185s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 190s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 195s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 200s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 205s) ...
Presolve removed 35732947 rows and 35608505 columns (presolve time = 210s) ...
Presolve removed 35744335 rows and 35617702 columns (presolve time = 215s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 220s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 225s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 230s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 235s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 240s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 245s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 250s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 255s) ...
Presolve removed 35744336 rows and 35617702 columns (presolve time = 260s) ...
Presolve removed 35745155 rows and 35628830 columns (presolve time = 265s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 270s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 275s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 280s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 285s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 290s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 295s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 300s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 305s) ...
Presolve removed 35745189 rows and 35628830 columns (presolve time = 310s) ...
Presolve removed 35746814 rows and 35630455 columns (presolve time = 323s) ...
Presolve removed 35746814 rows and 35630455 columns (presolve time = 334s) ...
Presolve removed 35749251 rows and 35632892 columns (presolve time = 390s) ...
Presolve removed 35747626 rows and 35631267 columns
Presolve time: 390.09s
Presolved: 4400594 rows, 4130859 columns, 15753610 nonzeros
Variable types: 245080 continuous, 3885779 integer (3749569 binary)
Found heuristic solution: objective 62798.000000Deterministic concurrent LP optimizer: primal simplex, dual simplex, and barrier
Showing barrier log only...Presolve removed 258210 rows and 250000 columns (presolve time = 6s) ...
Presolve removed 1031515 rows and 1023305 columns (presolve time = 10s) ...
Presolve removed 1031515 rows and 1023305 columns (presolve time = 15s) ...
Presolve removed 1031515 rows and 1023305 columns (presolve time = 20s) ...
Presolve removed 1031899 rows and 1023305 columns (presolve time = 25s) ...
Presolve removed 1053039 rows and 1028896 columns (presolve time = 30s) ...
Presolve removed 1053039 rows and 1028896 columns (presolve time = 35s) ...
Presolve removed 1053039 rows and 1028896 columns (presolve time = 40s) ...
Presolve removed 1059965 rows and 1028953 columns (presolve time = 45s) ...
Presolve removed 1059965 rows and 1028953 columns (presolve time = 50s) ...
Presolve removed 1059965 rows and 1028953 columns
Presolved: 3340629 rows, 3101906 columns, 13492070 nonzerosRoot barrier log...
Ordering time: 2.94s
Barrier statistics:
Dense cols : 1089
AA' NZ : 8.155e+07
Factor NZ : 1.409e+08 (roughly 4.0 GBytes of memory)
Factor Ops : 4.754e+10 (roughly 2 seconds per iteration)
Threads : 30Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 5.91211808e+06 4.06997484e+07 2.08e+06 2.85e+00 3.70e+03 512s
1 2.39250820e+06 7.25979098e+07 8.46e+05 8.89e+02 1.53e+03 515s
2 5.10436363e+05 9.99254981e+07 1.63e+05 3.49e+03 3.20e+02 518s
3 3.63649267e+05 9.38097546e+07 1.09e+05 4.30e+03 2.16e+02 523s
4 2.75471823e+05 8.82589379e+07 7.70e+04 2.36e+03 1.53e+02 527s
5 1.35387071e+05 8.20943416e+07 2.59e+04 3.21e+03 5.60e+01 530s
6 9.60053838e+04 7.20754516e+07 1.14e+04 2.02e+03 2.70e+01 533s
7 8.56810502e+04 5.84868343e+07 7.59e+03 1.12e+03 1.73e+01 537s
8 7.81227897e+04 4.21162370e+07 4.82e+03 3.62e+02 9.97e+00 541s
9 7.29613956e+04 2.47877733e+07 2.95e+03 1.28e+02 4.82e+00 546s
10 6.76408931e+04 1.29595078e+07 1.01e+03 1.38e+02 1.80e+00 549s
11 6.64601220e+04 6.48358183e+06 5.51e+02 7.46e+01 8.15e-01 553s
12 6.61487666e+04 4.03272544e+06 4.14e+02 7.85e+01 4.87e-01 557s
13 6.58661046e+04 2.56191353e+06 2.75e+02 2.16e+02 2.94e-01 563s
14 6.56926278e+04 1.80500292e+06 1.85e+02 1.44e+02 1.98e-01 569s
15 6.56121811e+04 1.32792631e+06 1.27e+02 1.05e+02 1.41e-01 574s
16 6.56112523e+04 9.94820789e+05 1.01e+02 9.45e+01 1.03e-01 577s
17 6.57047573e+04 8.68189300e+05 7.91e+01 8.10e+01 8.78e-02 581s
18 6.58154019e+04 7.24737482e+05 6.12e+01 6.57e+01 7.15e-02 587s
19 6.59973189e+04 4.07080792e+05 4.44e+01 3.31e+01 3.68e-02 593s
20 6.62984219e+04 2.83787898e+05 2.86e+01 2.01e+01 2.33e-02 598s
21 6.64503712e+04 2.56604276e+05 2.51e+01 1.76e+01 2.03e-02 603s
22 6.68399598e+04 2.00471751e+05 2.03e+01 1.23e+01 1.42e-02 610s
23 6.72451793e+04 1.62015766e+05 1.67e+01 8.61e+00 1.01e-02 615s
24 6.75643734e+04 1.34165692e+05 1.46e+01 5.93e+00 7.08e-03 622s
25 6.81522793e+04 1.16758163e+05 1.15e+01 4.25e+00 5.16e-03 627s
26 6.86966328e+04 1.07942242e+05 9.38e+00 3.38e+00 4.16e-03 631s
27 6.91034036e+04 9.93734350e+04 8.15e+00 2.54e+00 3.21e-03 635s
28 6.94032174e+04 9.33113010e+04 7.36e+00 1.95e+00 2.54e-03 638s
29 6.99843487e+04 8.80145317e+04 5.97e+00 1.43e+00 1.91e-03 641s
30 7.03200308e+04 8.41051912e+04 5.25e+00 1.04e+00 1.46e-03 644s
31 7.05807625e+04 8.20822630e+04 4.67e+00 8.42e-01 1.22e-03 646s
32 7.12855300e+04 7.91503036e+04 3.39e+00 5.30e-01 8.34e-04 650s
33 7.17162590e+04 7.64538614e+04 2.63e+00 2.77e-01 5.03e-04 654s
34 7.21667217e+04 7.53720810e+04 1.89e+00 1.72e-01 3.40e-04 658s
35 7.22772419e+04 7.50523019e+04 1.71e+00 1.42e-01 2.95e-04 660s
36 7.23600398e+04 7.49921869e+04 1.58e+00 1.36e-01 2.79e-04 663s
37 7.24142602e+04 7.49110885e+04 1.49e+00 1.29e-01 2.65e-04 665s
38 7.25909243e+04 7.47088698e+04 1.23e+00 1.10e-01 2.25e-04 668s
39 7.26499596e+04 7.45337280e+04 1.13e+00 9.43e-02 2.00e-04 671s
40 7.27527302e+04 7.44063412e+04 9.80e-01 8.32e-02 1.76e-04 674s
41 7.28321472e+04 7.42486010e+04 8.54e-01 6.93e-02 1.50e-04 679s
42 7.28852776e+04 7.39519459e+04 7.73e-01 4.39e-02 1.13e-04 682s
43 7.29887921e+04 7.38487422e+04 5.97e-01 3.45e-02 9.15e-05 684s
44 7.32336936e+04 7.36506431e+04 1.83e-01 1.78e-02 4.43e-05 687s
45 7.33703904e+04 7.35517820e+04 5.72e-04 9.42e-03 1.92e-05 689s
46 7.34191286e+04 7.34356640e+04 7.25e-05 4.11e-04 1.76e-06 693s
47 7.34259799e+04 7.34288957e+04 1.12e-05 7.14e-05 3.09e-07 695s
48 7.34271084e+04 7.34273451e+04 9.33e-07 4.46e-06 2.51e-08 699s
49 7.34272028e+04 7.34272189e+04 1.23e-07 3.97e-08 1.72e-09 701s
50 7.34272172e+04 7.34272173e+04 1.89e-09 2.79e-09 5.72e-12 704sBarrier solved model in 50 iterations and 704.35 seconds
Optimal objective 7.34272172e+04
Root crossover log...155401 DPushes remaining with DInf 0.0000000e+00 708s
12534 DPushes remaining with DInf 0.0000000e+00 711s
9082 DPushes remaining with DInf 0.0000000e+00 716s
4767 DPushes remaining with DInf 0.0000000e+00 721s
1054 DPushes remaining with DInf 0.0000000e+00 725s
0 DPushes remaining with DInf 3.9825782e-13 726s1335647 PPushes remaining with PInf 0.0000000e+00 727s
537925 PPushes remaining with PInf 0.0000000e+00 731s
339201 PPushes remaining with PInf 0.0000000e+00 736s
233721 PPushes remaining with PInf 0.0000000e+00 740s
163030 PPushes remaining with PInf 0.0000000e+00 746s
131456 PPushes remaining with PInf 0.0000000e+00 751s
120431 PPushes remaining with PInf 0.0000000e+00 755s
7101 PPushes remaining with PInf 0.0000000e+00 764s
3834 PPushes remaining with PInf 0.0000000e+00 766s
0 PPushes remaining with PInf 0.0000000e+00 769sPush phase complete: Pinf 0.0000000e+00, Dinf 3.6398055e-13 769s
Root simplex log...Iteration Objective Primal Inf. Dual Inf. Time
1353769 7.3427217e+04 0.000000e+00 0.000000e+00 772s
1353769 7.3427217e+04 0.000000e+00 0.000000e+00 776s
Concurrent spin time: 0.01sSolved with barrier
Root relaxation: objective 7.342722e+04, 1353769 iterations, 335.26 seconds
Total elapsed time = 884.25s
Total elapsed time = 926.51s
Total elapsed time = 951.54s
Total elapsed time = 966.24sNodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time0 0 73427.2172 0 528166 62798.0000 73427.2172 16.9% - 980s
H 0 0 66479.000000 73427.2172 10.5% - 5014s
0 0 73260.6796 0 21377 66479.0000 73260.6796 10.2% - 5313s
H 0 0 66519.000000 73260.6796 10.1% - 5534s
0 0 69239.0000 0 379 66519.0000 69239.0000 4.09% - 5545s
H 0 0 68888.000000 69239.0000 0.51% - 5546s
0 0 69230.4395 0 1454 68888.0000 69230.4395 0.50% - 5549s
H 0 0 69080.000000 69230.4395 0.22% - 5554s
0 0 69227.2659 0 1593 69080.0000 69227.2659 0.21% - 5554s
0 0 69226.8373 0 1434 69080.0000 69226.8373 0.21% - 5555s
0 0 69226.8373 0 1430 69080.0000 69226.8373 0.21% - 5556s
0 0 69210.0000 0 1814 69080.0000 69210.0000 0.19% - 5561s
H 0 0 69153.000000 69210.0000 0.08% - 5563s
0 0 69209.7273 0 1994 69153.0000 69209.7273 0.08% - 5564s
0 0 69209.6000 0 2602 69153.0000 69209.6000 0.08% - 5566s
0 0 69209.6000 0 2589 69153.0000 69209.6000 0.08% - 5567s
0 0 69207.0000 0 2928 69153.0000 69207.0000 0.08% - 5592s
H 0 0 69185.000000 69207.0000 0.03% - 5594s
0 0 69205.0435 0 2963 69185.0000 69205.0435 0.03% - 5596s
0 0 69204.4444 0 2840 69185.0000 69204.4444 0.03% - 5597s
0 0 69204.4444 0 2734 69185.0000 69204.4444 0.03% - 5598s
0 0 69204.0000 0 3016 69185.0000 69204.0000 0.03% - 5621s
0 0 69204.0000 0 2867 69185.0000 69204.0000 0.03% - 5624s
0 0 69204.0000 0 2759 69185.0000 69204.0000 0.03% - 5648s
H 0 0 69188.000000 69204.0000 0.02% - 5650s
0 0 69204.0000 0 3023 69188.0000 69204.0000 0.02% - 5652s
0 0 69203.7500 0 61 69188.0000 69203.7500 0.02% - 5683s
0 0 69203.7500 0 91 69188.0000 69203.7500 0.02% - 5685s
0 0 69203.7500 0 22 69188.0000 69203.7500 0.02% - 5709s
H 0 0 69203.000000 69203.7500 0.00% - 5710sCutting planes:
Gomory: 27
Cover: 331
Implied bound: 1188
Clique: 39
MIR: 282
StrongCG: 114
Flow cover: 548
GUB cover: 1
Zero half: 213Explored 1 nodes (2017641 simplex iterations) in 5715.11 seconds
Thread count was 32 (of 40 available processors)Solution count 10: 69203 69188 69185 ... 62798
Optimal solution found (tolerance 1.00e-04)
Best objective 6.920300000000e+04, best bound 6.920300000000e+04, gap 0.0000%0 -
Hi Monir,
Great, thanks for posting the log. Considering what MIPGapAbs does, it looks like Gurobi is behaving as expected - the absolute difference between the lower and upper bounds never gets close to 0.03. Gurobi terminates the optimization because the default relative optimality gap of 0.0001 (0.01%) is achieved. Note that setting MIPGap = 0.03 corresponds to a 3% MIP gap, while 0.0003 would correspond to a 0.03% MIP gap.
And no, the order of the parameters doesn't matter. Thanks!
Eli
0 -
Thank you so much Eli for your help.
Bests
0
Please sign in to leave a comment.
Comments
4 comments