Ok, might have a lead here.
First, I did not see a memory growth issue with large LP’s:
However, with the knapsack
MILP I do see the memory growth issue:
This chart comes from running:
for _ in range(1, stop=1000)
m = Model(CPLEX.Optimizer)
knapsack(m, 5000, 5000)
GC.gc()
end
The 1,000 iterations have not completed yet, but I think that we may have what we need.
The large ramp from 5 to ~7.5 GB RAM occurred during one particularly tough problem (recall that each problem uses random numbers - unfortunately I forgot to seed). Here is the CPLEX output for that problem (truncated):
Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
Found incumbent of value 0.000000 after 0.00 sec. (0.15 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 2457 rows and 0 columns.
Reduced MIP has 2543 rows, 5000 columns, and 12715000 nonzeros.
Reduced MIP has 5000 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 7.53 sec. (3885.04 ticks)
Probing time = 0.14 sec. (80.44 ticks)
Tried aggregator 1 time.
Reduced MIP has 2543 rows, 5000 columns, and 12715000 nonzeros.
Reduced MIP has 5000 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 6.31 sec. (2864.29 ticks)
Probing time = 0.09 sec. (80.44 ticks)
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 7 threads.
Root relaxation solution time = 10.25 sec. (2582.00 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0+ 0 0.0000 2502.5079 ---
* 0+ 0 4.5083 2502.5079 ---
0 0 22.4763 11 4.5083 22.4763 50 398.56%
* 0+ 0 18.2528 22.4763 23.14%
* 0+ 0 21.0700 22.4763 6.67%
* 0+ 0 21.7190 22.4763 3.49%
0 0 22.4581 11 21.7190 Cuts: 18 64 3.40%
0 0 22.4576 11 21.7190 Cuts: 6 69 3.40%
* 0+ 0 21.8001 22.4576 3.02%
0 0 cutoff 21.8001 22.4576 69 3.02%
Repeating presolve.
Tried aggregator 1 time.
MIP Presolve eliminated 2040 rows and 3992 columns.
Reduced MIP has 503 rows, 1008 columns, and 507024 nonzeros.
Reduced MIP has 1008 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.97 sec. (679.28 ticks)
Probing time = 0.01 sec. (5.97 ticks)
Tried aggregator 1 time.
Reduced MIP has 503 rows, 1008 columns, and 507024 nonzeros.
Reduced MIP has 1008 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.17 sec. (124.83 ticks)
Represolve time = 1.34 sec. (911.12 ticks)
Probing time = 0.01 sec. (5.97 ticks)
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 7 threads.
Root relaxation solution time = 0.08 sec. (104.41 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0+ 0 21.8001 22.4576 3.02%
0 0 22.4576 14 21.8001 22.4576 117 3.02%
0 0 22.4575 14 21.8001 MIRcuts: 1 119 3.02%
0 0 22.4572 14 21.8001 Cuts: 3 122 3.01%
0 2 22.4572 16 21.8001 22.4572 122 3.01%
Elapsed time = 48.87 sec. (25725.37 ticks, tree = 0.02 MB, solutions = 6)
56 49 22.3666 11 21.8001 22.4564 413 3.01%
155 133 22.2527 11 21.8001 22.4538 1066 3.00%
449 328 22.3635 11 21.8001 22.4470 2428 2.97%
758 551 22.1993 9 21.8001 22.4470 4097 2.97%
* 882+ 605 21.8389 22.4470 2.78%
1154 811 cutoff 21.8389 22.4470 6091 2.78%
1555 1073 22.4009 11 21.8389 22.4470 8149 2.78%
2163 1629 22.1155 11 21.8389 22.4470 11606 2.78%
2803 1934 21.9721 8 21.8389 22.4380 14608 2.74%
3484 2289 22.4030 13 21.8389 22.4303 17250 2.71%
Performing restart 1
Repeating presolve.
Tried aggregator 1 time.
MIP Presolve eliminated 68 rows and 129 columns.
Reduced MIP has 435 rows, 879 columns, and 382365 nonzeros.
Reduced MIP has 879 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.15 sec. (104.36 ticks)
Tried aggregator 1 time.
Reduced MIP has 435 rows, 879 columns, and 382365 nonzeros.
Reduced MIP has 879 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.15 sec. (99.48 ticks)
Represolve time = 0.41 sec. (267.73 ticks)
3490 0 22.4559 16 21.8389 Fract: 1 18702 2.68%
3490 0 22.4546 16 21.8389 Cuts: 3 18710 2.68%
3490 0 22.4531 16 21.8389 Cuts: 3 18715 2.68%
3490 0 22.4530 16 21.8389 Covers: 1 18717 2.68%
3490 2 22.4530 16 21.8389 22.4252 18717 2.68%
Elapsed time = 54.32 sec. (29410.48 ticks, tree = 0.02 MB, solutions = 7)
* 3550+ 5 21.8462 22.4252 2.65%
* 3696+ 126 21.8728 22.4252 2.53%
4151 459 22.3315 11 21.8728 22.4252 20723 2.53%
* 4881+ 1053 21.9738 22.4246 2.05%
6121 1850 22.3228 9 21.9738 22.4127 25581 2.00%
11179 6291 22.2919 10 21.9738 22.3917 40104 1.90%
17252 11458 cutoff 21.9738 22.3775 57685 1.84%
23033 16105 22.0311 9 21.9738 22.3666 73881 1.79%
29135 21444 22.2727 10 21.9738 22.3607 92276 1.76%
34271 25467 22.0781 11 21.9738 22.3537 105937 1.73%
38077 29100 22.2112 9 21.9738 22.3527 118626 1.72%
41051 31833 infeasible 21.9738 22.3527 128317 1.72%
44613 34563 22.1297 9 21.9738 22.3527 137987 1.72%
Elapsed time = 71.17 sec. (38949.44 ticks, tree = 19.38 MB, solutions = 10)
48042 38375 22.2276 11 21.9738 22.3527 151219 1.72%
51225 40450 22.1308 9 21.9738 22.3527 158722 1.72%
54511 43685 22.1107 7 21.9738 22.3527 170701 1.72%
58066 46238 22.2124 9 21.9738 22.3527 179692 1.72%
61820 49602 22.2949 12 21.9738 22.3527 191931 1.72%
65803 53016 22.2393 9 21.9738 22.3527 204364 1.72%
69824 56280 22.1853 10 21.9738 22.3527 216057 1.72%
* 72037+26724 22.0167 22.3527 1.53%
73846 59398 22.3229 9 22.0167 22.3527 227706 1.53%
Performing restart 2
Repeating presolve.
Tried aggregator 1 time.
MIP Presolve eliminated 204 rows and 414 columns.
Reduced MIP has 231 rows, 465 columns, and 107415 nonzeros.
Reduced MIP has 465 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.05 sec. (40.98 ticks)
Tried aggregator 1 time.
Reduced MIP has 231 rows, 465 columns, and 107415 nonzeros.
Reduced MIP has 465 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.04 sec. (28.23 ticks)
Represolve time = 0.17 sec. (97.59 ticks)
75341 502 22.1519 7 22.0167 22.3270 237311 1.41%
80452 4546 22.2649 9 22.0167 22.3270 253043 1.41%
Elapsed time = 84.80 sec. (48488.94 ticks, tree = 1.69 MB, solutions = 11)
88883 10128 22.3208 11 22.0167 22.3270 275251 1.41%
98582 17881 22.1827 11 22.0167 22.3270 304991 1.41%
...
11847407 65973 cutoff 22.0167 22.0212 46689655 0.02%
Elapsed time = 5944.18 sec. (3093759.75 ticks, tree = 158.24 MB, solutions = 11)
11861268 50653 cutoff 22.0167 22.0202 46712256 0.02%
11875147 37320 cutoff 22.0167 22.0194 46730984 0.01%
Cover cuts applied: 1151
Gomory fractional cuts applied: 4
Root node processing (before b&c):
Real time = 48.85 sec. (25720.58 ticks)
Parallel b&c, 7 threads:
Real time = 5911.32 sec. (3076135.19 ticks)
Sync time (average) = 457.98 sec.
Wait time (average) = 7.31 sec.
------------
Total (root+branch&cut) = 5960.17 sec. (3101855.77 ticks)
It seems as though the branch and cut memory consumption is not recovered before a new problem starts. I can run this with Xpress as well if needed, but it seems like it has to do with the memory used to store (and explore) feasible solutions. Could this be the issue and what do we do to address it?
(Also, I think that the plateau in the second chart is a period of time that something went to sleep on my laptop - but the logging script kept running ).