Is it normal for the gap to decrease very slowly when solving large-scale MILP models?
AnsweredC:\Users\jtzha\PycharmProjects\final_model\.venv\Scripts\python.exe C:\Users\jtzha\基于随机规划的长短期嵌套调度\sp_algorithm\sp_copy_unify.py
Set parameter Username
Set parameter LicenseID to value 2714983
Academic license - for non-commercial use only - expires 2026-09-26
Set parameter MIPGap to value 0.1
Set parameter Threads to value 32
Set parameter Presolve to value 1
Set parameter Method to value 2
Set parameter NodeMethod to value 2
Set parameter MIPFocus to value 1
Set parameter Heuristics to value 0.5
Set parameter NodefileStart to value 20
Set parameter Cuts to value 2
Set parameter MIRCuts to value 2
Set parameter ImpliedCuts to value 2
Set parameter FlowCoverCuts to value 2
Set parameter BranchDir to value 1
Gurobi Optimizer version 12.0.3 build v12.0.3rc0 (win64 - Windows 11+.0 (26200.2))
CPU model: Intel(R) Core(TM) i9-14900HX, instruction set [SSE2|AVX|AVX2]
Thread count: 24 physical cores, 32 logical processors, using up to 32 threads
Non-default parameters:
MIPGap 0.1
Method 2
BranchDir 1
Heuristics 0.5
MIPFocus 1
NodefileStart 20
NodeMethod 2
Cuts 2
FlowCoverCuts 2
ImpliedCuts 2
MIRCuts 2
Presolve 1
Threads 32
Optimize a model with 43703 rows, 56124 columns and 141658 nonzeros
Model fingerprint: 0xce370009
Model has 6048 SOS constraints
Model has 3492 simple general constraints
3492 PWL
Variable types: 52560 continuous, 3564 integer (3564 binary)
Coefficient statistics:
Matrix range [1e-02, 1e+03]
Objective range [6e-06, 1e+01]
Bounds range [1e+00, 3e+05]
RHS range [6e-05, 2e+05]
PWLCon x range [3e+02, 2e+05]
PWLCon y range [4e+02, 7e+02]
Presolve removed 4120 rows and 9698 columns
Presolve time: 0.22s
Presolved: 39583 rows, 46426 columns, 143144 nonzeros
Presolved model has 3503 SOS constraint(s)
Variable types: 40236 continuous, 6190 integer (6190 binary)
Root barrier log...
Ordering time: 0.01s
Barrier statistics:
AA' NZ : 1.389e+05
Factor NZ : 6.375e+05 (roughly 35 MB of memory)
Factor Ops : 1.883e+07 (less than 1 second per iteration)
Threads : 32
Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 -1.03556433e+06 3.19524278e+09 1.31e+05 1.74e-01 7.77e+05 0s
1 -8.17710327e+05 9.67351973e+08 5.59e+04 3.41e-13 3.23e+05 0s
2 -1.18680517e+06 2.80251115e+08 8.80e+02 6.25e-13 7.72e+03 0s
3 -6.65925564e+05 1.38313876e+08 1.45e+02 6.25e-13 2.07e+03 0s
4 -4.14788338e+05 5.96164743e+07 5.86e+01 1.24e-12 8.27e+02 0s
5 -4.55884719e+04 4.36370863e+07 3.49e+01 2.12e-12 5.60e+02 0s
6 -5.74234100e+02 1.46321373e+07 2.97e+01 1.08e-12 2.14e+02 0s
7 -3.96240345e+02 8.27614337e+06 5.14e+00 7.82e-13 9.34e+01 0s
8 -2.05229180e+02 1.57593645e+06 1.79e+00 7.69e-13 1.72e+01 0s
9 -6.66436186e+00 1.73601392e+05 8.14e-03 2.03e-13 1.79e+00 0s
10 -2.92885557e+00 5.07052415e+03 7.50e-08 8.53e-14 5.23e-02 0s
11 2.60931410e+00 2.02400455e+03 2.30e-08 2.84e-14 2.08e-02 1s
12 7.98590113e+00 5.89876103e+02 1.70e-08 2.84e-14 6.00e-03 1s
13 1.33386844e+01 1.36320579e+02 2.46e-08 2.13e-14 1.27e-03 1s
14 1.81246199e+01 8.09119018e+01 1.24e-08 2.13e-14 6.47e-04 1s
15 2.05975328e+01 6.00762952e+01 1.08e-08 1.07e-14 4.07e-04 1s
16 2.27436231e+01 4.73956296e+01 1.99e-08 9.45e-15 2.54e-04 1s
17 2.41224380e+01 4.04107770e+01 2.19e-08 5.47e-15 1.68e-04 1s
18 2.50783610e+01 3.69029125e+01 1.70e-08 8.16e-15 1.22e-04 1s
19 2.61391716e+01 3.31920226e+01 1.59e-08 4.76e-15 7.27e-05 1s
20 2.67252058e+01 3.18311368e+01 1.26e-08 2.04e-14 5.26e-05 1s
21 2.72149044e+01 3.03716025e+01 7.45e-09 4.44e-16 3.25e-05 1s
22 2.75980698e+01 2.95537746e+01 5.82e-09 2.65e-12 2.02e-05 1s
23 2.77429843e+01 2.91143220e+01 4.65e-09 3.59e-12 1.41e-05 1s
24 2.78420873e+01 2.88361615e+01 3.82e-09 2.00e-10 1.02e-05 1s
25 2.80107258e+01 2.87114891e+01 2.56e-09 2.93e-10 7.23e-06 1s
26 2.81190529e+01 2.85562794e+01 1.78e-09 3.16e-10 4.51e-06 1s
27 2.81785083e+01 2.84373074e+01 2.38e-09 3.00e-10 2.67e-06 1s
28 2.82048576e+01 2.83785835e+01 3.29e-09 2.14e-10 1.79e-06 1s
29 2.82683891e+01 2.83528311e+01 6.99e-09 1.52e-10 8.73e-07 1s
30 2.82942987e+01 2.83384816e+01 4.21e-09 9.98e-11 4.57e-07 1s
31 2.83020782e+01 2.83328858e+01 2.72e-09 7.31e-11 3.19e-07 1s
32 2.83115902e+01 2.83194860e+01 8.39e-10 1.43e-11 8.16e-08 1s
33 2.83142615e+01 2.83178227e+01 1.43e-09 6.91e-12 3.68e-08 1s
34 2.83158429e+01 2.83161774e+01 1.79e-09 2.59e-12 3.44e-09 1s
35 2.83159896e+01 2.83160444e+01 3.03e-10 3.36e-13 5.63e-10 1s
36 2.83160202e+01 2.83160228e+01 7.43e-09 3.91e-13 2.74e-11 1s
Barrier solved model in 36 iterations and 0.74 seconds (1.10 work units)
Optimal objective 2.83160202e+01
Extra simplex iterations after uncrush: 251
Root relaxation: objective 2.831602e+01, 9170 iterations, 0.59 seconds (0.75 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 28.31602 0 2259 - 28.31602 - - 1s
0 0 28.31602 0 3120 - 28.31602 - - 2s
0 0 28.16762 0 3056 - 28.16762 - - 5s
0 0 28.16762 0 3060 - 28.16762 - - 6s
0 0 28.05918 0 3719 - 28.05918 - - 10s
0 0 28.05918 0 3731 - 28.05918 - - 11s
0 0 27.99083 0 3699 - 27.99083 - - 16s
0 0 27.99083 0 3685 - 27.99083 - - 18s
0 0 27.97073 0 3743 - 27.97073 - - 23s
0 0 27.97072 0 3740 - 27.97072 - - 25s
0 0 27.92919 0 3697 - 27.92919 - - 31s
0 0 27.92919 0 3700 - 27.92919 - - 32s
0 0 27.92326 0 3724 - 27.92326 - - 38s
0 0 27.90631 0 3731 - 27.90631 - - 44s
0 0 27.90280 0 3784 - 27.90280 - - 48s
0 0 27.89430 0 3469 - 27.89430 - - 54s
H 0 0 -2741223.439 27.89430 100% - 65s
0 2 27.89428 0 3461 -2741223.4 27.89428 100% - 68s
H 1 4 -1325414.702 27.89428 100% 30053 71s
3 8 27.89255 2 3728 -1325414.7 27.89428 100% 45476 78s
7 16 27.88769 3 3737 -1325414.7 27.89255 100% 39369 83s
15 32 27.88511 4 3779 -1325414.7 27.88892 100% 32422 91s
H 31 62 -1000493.238 27.88607 100% 28473 105s
63 94 27.87699 6 3824 -1000493.2 27.88453 100% 27601 130s
95 158 27.84009 7 3799 -1000493.2 27.88452 100% 27603 157s
159 221 27.83217 9 3798 -1000493.2 27.88452 100% 27438 183s
H 169 221 -1000493.231 27.88452 100% 27323 183s
H 222 253 -1000493.223 27.88452 100% 27118 221s
H 223 253 -1000493.223 27.88452 100% 27124 221s
H 237 253 -999899.8425 27.88452 100% 27139 221s
254 317 27.82172 12 3795 -999899.84 27.88452 100% 27292 248s
318 349 27.82101 14 3794 -999899.84 27.88452 100% 27026 290s
350 381 27.82100 15 3790 -999899.84 27.88452 100% 26998 321s
382 413 27.82101 16 3787 -999899.84 27.88452 100% 26957 343s
414 445 27.82086 17 3788 -999899.84 27.88452 100% 26958 363s
446 477 27.82086 18 3787 -999899.84 27.88452 100% 26926 383s
478 508 27.82086 19 3781 -999899.84 27.88452 100% 26941 406s
511 540 27.82073 20 3777 -999899.84 27.88452 100% 26855 427s
543 572 27.06552 21 3586 -999899.84 27.88452 100% 26837 449s
575 604 27.06552 22 3589 -999899.84 27.88452 100% 26807 476s
607 636 27.01883 23 3541 -999899.84 27.88452 100% 26714 499s
639 668 27.01821 24 3532 -999899.84 27.88452 100% 26694 526s
671 700 27.01821 25 3543 -999899.84 27.88452 100% 26692 558s
703 732 27.01735 26 3536 -999899.84 27.88452 100% 26663 585s
735 764 27.01710 27 3536 -999899.84 27.88452 100% 26588 617s
767 796 27.01710 28 3543 -999899.84 27.88452 100% 26550 645s
799 836 27.01680 29 3542 -999899.84 27.88452 100% 26485 669s
839 877 27.01651 30 3538 -999899.84 27.88452 100% 26441 694s
882 921 27.01484 31 3545 -999899.84 27.88452 100% 26324 722s
926 953 27.01456 32 3551 -999899.84 27.88452 100% 26269 754s
H 952 953 -999899.6762 27.88452 100% 26228 754s
958 1016 27.01444 33 3542 -999899.68 27.88452 100% 26242 783s
1021 1056 27.01424 35 3528 -999899.68 27.88452 100% 26191 819s
1065 1095 27.01414 36 3530 -999899.68 27.88452 100% 26162 858s
1110 1126 27.01408 37 3531 -999899.68 27.88452 100% 26111 911s
H 1113 1126 -999898.2029 27.88452 100% 26066 911s
1143 1180 27.01408 37 3527 -999898.20 27.88452 100% 26112 944s
H 1147 1180 -999897.0033 27.88452 100% 26039 944s
H 1157 1180 -999896.8551 27.88452 100% 26016 944s
1217 1205 27.00780 39 3516 -999896.86 27.88452 100% 25890 1017s
H 1226 1205 -999895.2640 27.88452 100% 25832 1017s
H 1256 1235 -999895.2632 27.88452 100% 25710 1104s
1290 1267 27.00779 41 3514 -999895.26 27.88452 100% 25689 1189s
H 1316 1267 -999895.2626 27.88452 100% 25627 1189s
1322 1360 27.00779 42 3518 -999895.26 27.88452 100% 25640 1230s
H 1325 1360 -999895.2575 27.88452 100% 25625 1230s
1417 1390 25.13215 44 3415 -999895.26 27.88452 100% 25517 1310s
1451 1423 24.49593 44 3283 -999895.26 27.88452 100% 25422 1398s
1486 1436 24.49593 45 3287 -999895.26 27.88452 100% 25341 1489s
1537 1477 24.49593 46 3280 -999895.26 27.88452 100% 24991 1559s
H 1550 1477 -999895.2435 27.88452 100% 24895 1559s
1610 1545 24.49593 47 3287 -999895.24 27.88452 100% 24657 1604s
1747 1610 infeasible 50 -999895.24 27.88452 100% 24095 1651s
-
可以看到,找到可行解后,gap长期是100%,不太清楚这种情况是否正常
As you can see, after finding a feasible solution, the gap remains at 100% for a long time. I'm not sure if this is normal.
0 -
Hi 玉鑫 张 ,
This can be normal, it all depends on the model.
Firstly though, I think you are setting way too many parameters. When we make parameter recommendations for customers, based on their models, we are generally trying to keep the number to 2 or 3 parameters. Choosing parameters should really be backed by a lot of experimental evidence, see “How can I make accurate comparisons?”
The other thing to note is this line:Presolved model has 3503 SOS constraint(s)
The SOS constraints, which are not linearized during presolve, represent a large chunk of information that is missing from the linear relaxation, which means the dual bound produced from solving the linear relaxation is very likely weak. You have directly defined some SOS constraints, but they will also be produced from the PWL constraints. Sometimes SOS constraints are not linearized when the user has not provided bounds on their variables, or perhaps used weak bounds. I think it would be worth trying to identify if bounds on variables could be tightened, and see if this helps with the number of SOS that remain after presolve.
I would also test the effect of PreSOS1BigM and PreSOS2BigM, that is set these to large numbers (1e10 is the max) - use default values for all other parameters - and see whether the SOS constraints are linearized. Note that setting these parameters to large values can introduce numerical issues.
- Riley0
Please sign in to leave a comment.
Comments
2 comments