Comparing memory usage between different model formulations
AnsweredHi,
I have two equivalent optimization models with different formulations that result in different numbers of variables and constraints. I want to compare their memory usage to demonstrate that one approach is more memory-efficient than the other.
My current measurement approach:
self.model.update()
import psutil
import gc
# Clean up memory before measurement
gc.collect()
# Process memory
process = psutil.Process(os.getpid())
memory_before = process.memory_info().rss / 1024 / 1024 # MB
# Optimization
self.model.optimize()
# Measurements after optimization
memory_after = process.memory_info().rss / 1024 / 1024 # MB
memory_used_process = memory_after - memory_before
# Clean up after measurement
gc.collect()
print("========================================================")
print("Memory used : {}".format(memory_used_process))I got printings for the first model like:
Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (linux64 - "Ubuntu 20.04.6 LTS")
CPU model: 12th Gen Intel(R) Core(TM) i7-12800H, instruction set [SSE2|AVX|AVX2]
Thread count: 20 physical cores, 20 logical processors, using up to 20 threads
Optimize a model with 7312 rows, 1444 columns and 32070 nonzeros
Model fingerprint: 0xa36f2444
Model has 120 quadratic objective terms
Variable types: 712 continuous, 732 integer (732 binary)
Coefficient statistics:
Matrix range [5e-01, 1e+01]
Objective range [3e-02, 5e+00]
QObjective range [2e-03, 2e-03]
Bounds range [1e+00, 1e+01]
RHS range [8e-01, 2e+01]
Presolve removed 6076 rows and 241 columns
Presolve time: 0.07s
Presolved: 1236 rows, 1203 columns, 18683 nonzeros
Presolved model has 120 quadratic objective terms
Variable types: 562 continuous, 641 integer (641 binary)
Root relaxation: objective 3.927866e+01, 7136 iterations, 0.18 seconds (0.19 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 39.27866 0 169 - 39.27866 - - 0s
0 0 40.53684 0 153 - 40.53684 - - 0s
0 0 40.56397 0 155 - 40.56397 - - 0s
0 0 40.56397 0 155 - 40.56397 - - 0s
0 0 41.07264 0 142 - 41.07264 - - 0s
0 0 41.17210 0 130 - 41.17210 - - 0s
0 0 41.18257 0 142 - 41.18257 - - 0s
0 0 41.18280 0 143 - 41.18280 - - 0s
H 0 0 77.2694962 41.18280 46.7% - 0s
H 0 0 74.8349122 41.18280 45.0% - 0s
...
...
Cutting planes:
Learned: 1
Gomory: 2
Cover: 672
Implied bound: 87
Projected implied bound: 35
Clique: 7
MIR: 30
StrongCG: 2
Flow cover: 46
GUB cover: 7
Inf proof: 1
Zero half: 1
RLT: 119
Relax-and-lift: 40
BQP: 28
Explored 30480 nodes (8032213 simplex iterations) in 62.99 seconds (57.81 work units)
Thread count was 20 (of 20 available processors)
Solution count 10: 66.2826 66.2826 66.2826 ... 71.6035
Optimal solution found (tolerance 1.00e-04)
Warning: max constraint violation (1.9094e-06) exceeds tolerance
Best objective 6.628263846841e+01, best bound 6.628263846841e+01, gap 0.0000%
========================================================
Memory used : 443.62109375and for the second model like:
Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (linux64 - "Ubuntu 20.04.6 LTS")
CPU model: 12th Gen Intel(R) Core(TM) i7-12800H, instruction set [SSE2|AVX|AVX2]
Thread count: 20 physical cores, 20 logical processors, using up to 20 threads
Optimize a model with 15648 rows, 1450 columns and 40477 nonzeros
Model fingerprint: 0xda9ad3b4
Model has 120 quadratic objective terms
Variable types: 718 continuous, 732 integer (732 binary)
Coefficient statistics:
Matrix range [5e-01, 1e+01]
Objective range [1e-01, 5e+00]
QObjective range [2e-03, 2e-03]
Bounds range [1e+00, 1e+01]
RHS range [8e-01, 2e+01]
Presolve removed 11858 rows and 262 columns
Presolve time: 0.12s
Presolved: 3790 rows, 1188 columns, 24211 nonzeros
Presolved model has 120 quadratic objective terms
Variable types: 276 continuous, 912 integer (910 binary)
Root relaxation: objective 2.006742e+01, 3137 iterations, 0.08 seconds (0.09 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 20.06742 0 473 - 20.06742 - - 0s
0 0 20.06985 0 468 - 20.06985 - - 0s
H 0 0 62.6326794 20.06985 68.0% - 0s
H 0 0 61.8226794 20.06985 67.5% - 0s
0 0 23.09250 0 404 61.82268 23.09250 62.6% - 2s
0 0 23.20147 0 343 61.82268 23.20147 62.5% - 2s
0 0 23.20147 0 348 61.82268 23.20147 62.5% - 2s
...
...
Cutting planes:
Gomory: 6
Cover: 86
Implied bound: 1
Clique: 12
MIR: 4
StrongCG: 2
Flow cover: 15
GUB cover: 22
Zero half: 13
RLT: 18
Relax-and-lift: 24
Explored 72860 nodes (28632638 simplex iterations) in 572.68 seconds (288.49 work units)
Thread count was 20 (of 20 available processors)
Solution count 10: 44.4142 44.4142 44.4151 ... 46.4391
Optimal solution found (tolerance 1.00e-04)
Best objective 4.441423025970e+01, best bound 4.441423025970e+01, gap 0.0000%
========================================================
Memory used : 631.9296875May I ask:
1. Is measuring process RSS before/after optimization the right approach for comparing memory usage between different Gurobi model formulations?
2. How can I validate that these numbers are reasonable? Should memory usage be roughly proportional to the number of nonzeros in the model matrix?
Thank you!
Xuan Lin
-
Hi Xuan
Should memory usage be roughly proportional to the number of nonzeros in the model matrix?
The memory will be more dependent on what the solver is doing.
I'd recommend profiling the memory with psrecord. We use this tool internally to monitor memory usage over the course of an optimization. It is very simple to use. It is a Python package but you can use it to profile anything which can be run from the command line.
If you only want to profile the optimization and not the model building, then I would write the model out to an MPS file (.mps or .mps.bz2) and run it using gurobi_cl from the command line (as an argument to psrecord).
- Riley
0 -
Hi,
Thanks for the reply! I tried to run either:
psrecord "gurobi_cl point_mass_04_lnf.mps" --log activity.txt --plot memory_usage.png --interval 1or:
psrecord "python3 run_model.py" --log activity.txt --plot memory_usage.png --interval 1and got memory usage that is identical throughout the solving process:
# Elapsed time CPU (%) Real (MB) Virtual (MB) 0.010 0.000 0.516 2.555 1.010 0.000 0.516 2.555 2.010 0.000 0.516 2.555 3.011 0.000 0.516 2.555 4.011 0.000 0.516 2.555 5.011 0.000 0.516 2.555 6.012 0.000 0.516 2.555 7.012 0.000 0.516 2.555 8.012 0.000 0.516 2.555 9.013 0.000 0.516 2.555 10.013 0.000 0.516 2.555 11.013 0.000 0.516 2.555 12.014 0.000 0.516 2.555 13.014 0.000 0.516 2.555 14.014 0.000 0.516 2.555 15.015 0.000 0.516 2.555 16.015 0.000 0.516 2.555 17.015 0.000 0.516 2.555 18.016 0.000 0.516 2.555 19.016 0.000 0.516 2.555Does this seem correct?
Xuan Lin1 -
Hi Xuan,
I'd be more worried about the 0% CPU… It doesn't look right.
Does `gurobi_cl point_mass_04_lnf.mps` work by itself ok?
Was a Gurobi logfile produced when you ran it through psrecord?
- Riley
0 -
Hi Riley,
Yes, running gurobi_cl point_mass_04_lnf.mps works ok and generate the logfile correctly.
I figured that if I run:psrecord "gurobi_cl point_mass_04_lnf.mps" --include-children --log activity.txt --plot memory_usage.png --interval 1The results seem better:
# Elapsed time CPU (%) Real (MB) Virtual (MB) 0.000 0.000 2.582 51.957 2.004 1239.900 186.945 1455.988 4.009 1971.300 235.754 1480.082 6.015 1948.600 299.535 1498.406 8.022 1732.900 316.113 1509.027 10.030 343.100 327.051 1511.203 12.042 798.700 330.402 1511.203 14.051 1439.500 323.668 1470.398 16.061 1945.500 341.445 1470.398 18.070 1940.100 347.246 1470.398 20.080 1881.600 350.438 1470.398 22.091 1933.200 359.719 1470.398 24.102 1925.400 363.070 1470.398 26.114 1905.400 364.359 1470.398 28.129 1951.400 366.164 1470.398 30.141 1973.300 421.379 1470.949 32.152 1971.000 422.910 1470.949 34.163 1976.500 431.820 1470.949 36.175 1959.900 427.793 1470.949 38.189 1952.000 438.570 1472.199 40.198 1953.700 430.730 1472.199 42.225 1930.800 430.152 1472.199 44.236 1971.100 422.723 1472.508 46.258 1976.600 431.598 1472.508 48.269 1971.500 433.402 1472.508 50.278 1968.100 424.930 1472.508 52.305 1966.900 427.250 1472.508 54.317 1960.600 428.023 1472.508 56.328 1936.900 429.828 1472.508 58.357 1934.800 410.414 1466.879 60.385 1958.600 412.219 1466.879 62.396 1963.200 407.383 1467.012 64.408 1926.600 407.641 1467.012 66.433 1918.100 409.188 1467.152and the logging is:
Gurobi 12.0.0 (linux64, gurobi_cl) logging started Fri Jul 18 01:06:33 2025 Set parameter Username Set parameter LicenseID to value 2588209 Set parameter LogFile to value "gurobi.log" Using license file /home/x/gurobi.lic Academic license - for non-commercial use only - expires 2025-11-21 Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (linux64 - "Ubuntu 20.04.6 LTS") Copyright (c) 2024, Gurobi Optimization, LLC Read MPS format model from file point_mass_04_lnf.mps Reading time = 0.01 seconds point_mass_dynamics: 6964 rows, 1444 columns, 23140 nonzeros Using Gurobi shared library /home/x/Desktop/gurobi1200/linux64/lib/libgurobi.so.12.0.0 CPU model: 12th Gen Intel(R) Core(TM) i7-12800H, instruction set [SSE2|AVX|AVX2] Thread count: 20 physical cores, 20 logical processors, using up to 20 threads Optimize a model with 6964 rows, 1444 columns and 23140 nonzeros Model fingerprint: 0x297b88b5 Model has 120 quadratic objective terms Variable types: 712 continuous, 732 integer (732 binary) Coefficient statistics: Matrix range [5e-01, 1e+01] Objective range [3e-02, 5e+00] QObjective range [2e-03, 2e-03] Bounds range [1e+00, 1e+01] RHS range [8e-01, 2e+01] Presolve removed 6015 rows and 241 columns Presolve time: 0.05s Presolved: 949 rows, 1203 columns, 10587 nonzeros Presolved model has 120 quadratic objective terms Variable types: 564 continuous, 639 integer (639 binary) Found heuristic solution: objective 135.5457531 Root relaxation: objective 3.580706e+01, 2383 iterations, 0.04 seconds (0.04 work units) Nodes | Current Node | Objective Bounds | Work Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time 0 0 35.80706 0 126 135.54575 35.80706 73.6% - 0s H 0 0 130.6307531 35.80706 72.6% - 0s 0 0 37.04199 0 48 130.63075 37.04199 71.6% - 0s 0 0 37.70576 0 77 130.63075 37.70576 71.1% - 0s 0 0 37.73101 0 80 130.63075 37.73101 71.1% - 0s 0 0 37.73168 0 79 130.63075 37.73168 71.1% - 0s 0 0 38.00876 0 99 130.63075 38.00876 70.9% - 0s 0 0 38.05964 0 93 130.63075 38.05964 70.9% - 0s 0 0 38.06857 0 101 130.63075 38.06857 70.9% - 0s 0 0 38.06938 0 103 130.63075 38.06938 70.9% - 0s 0 0 38.06940 0 103 130.63075 38.06940 70.9% - 0s 0 0 38.55983 0 133 130.63075 38.55983 70.5% - 0s H 0 0 121.3517422 38.56235 68.2% - 0s 0 0 38.59448 0 132 121.35174 38.59448 68.2% - 0s 0 0 38.59562 0 134 121.35174 38.59562 68.2% - 0s 0 0 38.59601 0 136 121.35174 38.59601 68.2% - 0s 0 0 38.74478 0 142 121.35174 38.74478 68.1% - 0s 0 0 38.92598 0 135 121.35174 38.92598 67.9% - 0s 0 0 38.92598 0 154 121.35174 38.92598 67.9% - 0s 0 0 39.00821 0 151 121.35174 39.00821 67.9% - 0s 0 0 39.44234 0 178 121.35174 39.44234 67.5% - 0s 0 0 39.44234 0 178 121.35174 39.44234 67.5% - 0s H 0 0 97.9745372 39.44234 59.7% - 0s H 0 0 97.6305046 39.44234 59.6% - 0s H 0 0 97.6299960 39.44234 59.6% - 0s H 0 0 95.5747631 39.44234 58.7% - 0s H 0 0 94.5447631 39.44234 58.3% - 0s H 0 2 86.9817194 39.44234 54.7% - 0s 0 2 39.44234 0 178 86.98172 39.44234 54.7% - 0s H 29 46 85.2573549 40.00175 53.1% 673 1s H 30 46 84.9125497 40.00719 52.9% 674 1s H 33 46 83.2042219 40.00719 51.9% 638 1s H 49 96 81.8292219 40.52965 50.5% 640 1s H 107 121 80.1052991 40.52965 49.4% 425 1s H 108 121 79.7604939 40.52965 49.2% 424 1s H 108 121 78.3885812 40.52965 48.3% 424 1s H 130 121 78.0909673 40.52965 48.1% 409 1s H 187 203 77.0564542 40.52965 47.4% 380 1s H 404 342 70.6645756 40.77280 42.3% 306 2s H 410 383 69.3045756 40.77280 41.2% 305 2s H 949 665 66.9643807 41.50713 38.0% 222 2s H 954 665 66.9619708 41.50713 38.0% 222 2s H 960 665 66.5528510 41.50713 37.6% 223 2s H 1059 758 64.2117496 41.73247 35.0% 217 3s H 1079 758 63.8678510 41.73247 34.7% 216 3s 2412 1395 56.57924 30 92 63.86785 42.85268 32.9% 191 5s 3502 1980 62.42298 15 241 63.86785 43.68639 31.6% 173 10s 3979 2118 50.33430 25 84 63.86785 45.75183 28.4% 204 15s 5271 2257 60.27164 39 84 63.86785 49.13407 23.1% 229 20s 7360 2234 62.78809 25 94 63.86785 50.94938 20.2% 247 25s 9553 1966 cutoff 39 63.86785 51.89321 18.7% 247 30s 10543 2193 59.16278 44 136 63.86785 52.59604 17.6% 248 35s 11925 2356 59.19675 32 40 63.86785 53.76004 15.8% 251 40s 14110 2550 cutoff 43 63.86785 54.82778 14.2% 252 46s 15787 2679 cutoff 45 63.86785 55.52790 13.1% 252 50s 19014 2625 cutoff 76 63.86785 57.26977 10.3% 252 55s 21881 2209 62.57605 55 49 63.86785 58.73654 8.03% 251 60s 26611 0 cutoff 38 63.86785 60.97570 4.53% 243 65s Cutting planes: Learned: 2 Gomory: 5 Cover: 586 Implied bound: 70 Projected implied bound: 85 Clique: 18 MIR: 180 StrongCG: 29 Flow cover: 92 GUB cover: 57 Inf proof: 3 Zero half: 4 Mod-K: 1 RLT: 101 Relax-and-lift: 180 BQP: 30 Explored 27439 nodes (6585949 simplex iterations) in 65.67 seconds (56.53 work units) Thread count was 20 (of 20 available processors) Solution count 10: 63.8679 64.2117 66.5529 ... 79.7605 Optimal solution found (tolerance 1.00e-04) Best objective 6.386785104762e+01, best bound 6.386785104762e+01, gap 0.0000%Does this result (top CPU usage 2000%, and memory usage grow with the solving time) align up with what you would expect better?
Thank you!
Xuan Lin0 -
Hi Xuan,
Cool, this looks good.
Branching can be a memory hog, because it parallelizes by processing multiple nodes in parallel, which is why if there is limited memory we recommend reducing threads via the Threads parameter. The log indicates (at the beginning) that the solver will use up to 20 threads - the 2000% CPU usage corresponds to 20 threads each running on a CPU.
- Riley
0 -
Hi,
Thanks! I have another baseline model that is equivalent, but with looser convex relaxations and about 2x more constraints. The solving speed is usually slower. For this case, I got memory usage:
# Elapsed time CPU (%) Real (MB) Virtual (MB) 0.000 0.000 2.562 51.953 3.004 276.100 91.215 245.961 6.010 300.300 125.098 269.844 9.014 631.500 129.469 1493.910 12.018 672.900 134.176 1483.906 15.023 1593.600 258.199 1483.906 18.029 1279.400 347.254 1479.547 21.035 1920.000 367.105 1479.547 24.040 1844.200 398.039 1479.547 27.046 1950.500 449.000 1479.664 30.052 1810.300 456.219 1479.664 33.057 1873.900 461.891 1479.664 36.064 1926.000 462.922 1479.793 39.070 1882.100 466.273 1479.793 42.077 1833.800 471.172 1479.930 45.083 1943.600 478.391 1479.930 48.090 1602.200 482.258 1484.992 51.094 256.600 501.109 1501.551 54.098 316.900 522.578 1514.957 57.103 316.200 537.445 1521.281 60.107 316.300 548.938 1521.281 63.111 316.200 565.008 1533.000 66.115 317.900 545.387 1519.664 69.119 316.600 548.367 1530.797 72.123 320.200 550.781 1524.500 75.127 316.200 560.320 1536.223 78.131 322.900 546.727 1524.652 81.136 323.600 573.582 1550.121 84.140 308.200 563.684 1537.273 87.144 316.600 562.113 1536.945 90.148 316.600 562.426 1536.945 93.152 299.900 545.801 1520.820 96.156 316.500 560.738 1537.277 99.161 309.600 553.695 1532.500 102.165 323.900 544.500 1521.219 105.169 262.600 544.445 1506.551 108.174 1042.600 532.125 1506.551 111.178 1281.800 549.914 1517.777 114.186 1412.400 558.938 1518.125 117.197 1886.000 560.227 1518.125 120.209 1775.500 565.641 1518.293 123.218 1744.400 576.984 1612.855 126.230 1907.000 574.434 1603.688 129.240 1984.900 590.043 1642.238 132.252 1634.300 592.891 1642.590 135.256 1820.900 603.074 1643.723 138.263 1904.300 620.688 1671.059 141.269 1839.300 622.938 1659.016 144.276 1820.300 623.809 1646.496 147.282 1966.400 625.098 1648.605 150.288 1937.800 635.391 1649.660 153.296 1876.800 641.555 1663.012 156.304 1823.800 642.844 1663.012 159.339 1851.600 643.211 1689.832 162.361 1991.200 645.273 1689.832 165.380 1990.600 644.406 1664.000 168.432 1884.200 643.520 1678.137 171.444 1977.200 646.871 1678.137 174.476 1944.900 644.926 1665.547 177.512 1997.000 646.730 1665.547 180.521 1920.500 646.152 1665.633 183.561 1990.300 645.914 1679.637 186.585 1993.700 647.461 1679.637 189.596 1989.500 647.473 1680.996 192.632 1995.100 648.242 1680.996 195.664 1992.500 649.789 1680.996 198.687 1993.900 648.344 1682.355 201.716 1993.400 649.891 1682.355 204.727 1970.700 650.391 1682.871 207.762 1997.100 650.906 1682.871 210.771 1911.400 663.430 1684.652 213.799 1982.100 665.492 1684.652 216.852 1975.900 666.266 1684.652 219.896 1917.700 664.715 1685.402 222.939 1923.100 666.777 1685.402 226.000 1909.500 663.648 1686.105 229.021 1899.000 667.516 1686.105 232.080 1874.300 668.547 1686.105 235.103 1921.300 670.516 1702.324 238.164 1948.000 671.805 1702.324 241.205 1966.600 671.984 1718.559 244.264 1924.700 673.016 1718.559 247.325 1910.800 671.426 1718.887 250.384 1992.200 672.715 1718.887 253.440 1987.300 673.746 1718.887 256.456 1966.500 672.828 1719.598 259.521 1991.700 674.117 1719.598 262.563 1990.300 672.523 1719.652 265.615 1986.600 673.812 1719.652 268.659 1944.900 671.578 1720.090 271.678 1986.200 673.898 1720.090 274.722 1989.000 675.445 1720.090 277.767 1991.800 673.336 1720.309 280.831 1992.100 674.625 1720.309 283.884 1994.900 676.688 1720.309 286.927 1990.600 677.977 1720.309 289.989 1979.000 678.234 1720.309 293.048 1997.400 678.750 1720.309 296.076 1933.700 677.520 1735.910 299.120 1992.400 678.551 1735.910 302.167 1982.500 674.812 1736.203 305.209 1976.400 677.391 1736.203 308.272 1993.600 678.422 1736.203 311.332 1970.200 677.785 1736.906 314.373 1990.600 715.285 1736.906 317.417 1982.400 789.602 1755.281 320.468 1737.300 821.453 1741.145 323.503 1993.800 838.340 1890.645 326.550 1993.900 860.648 1900.176 329.608 1930.400 861.949 1873.711 332.652 1987.100 864.488 1881.188 335.712 1995.300 864.762 1817.188 338.760 1991.400 871.113 1881.188 341.812 1992.700 872.676 1881.188 344.868 1997.800 860.965 1753.188 347.887 1992.200 864.465 1881.188 350.950 1991.300 864.555 1817.188 354.012 1985.700 865.070 1817.188 357.042 1991.700 866.133 1817.188 360.105 2002.000 867.426 1817.188 363.165 1987.100 868.203 1753.188 366.203 1985.900 817.992 1710.836 369.264 1991.500 820.156 1718.391 372.324 1994.600 822.152 1718.391 375.388 1899.300 822.176 1711.465 378.412 1905.100 824.785 1718.984 381.468 1978.400 825.355 1654.984 384.476 1968.800 827.398 1657.473 387.487 1949.900 812.172 1683.160 390.499 1910.000 794.473 1683.590 393.511 1991.000 796.020 1683.590 396.519 1865.600 795.582 1683.668 399.548 1998.100 795.840 1683.668 402.587 1878.300 795.133 1685.191 405.650 1990.300 795.648 1685.191 408.703 1996.000 796.422 1685.191 411.766 1994.400 796.938 1685.191 414.830 1906.700 795.176 1687.027 417.857 1991.400 797.496 1687.027 420.901 1983.200 799.316 1687.676 423.965 1960.500 804.980 1703.426 427.032 1995.500 808.320 1703.426 430.072 1939.900 808.578 1703.426 433.133 1991.800 808.578 1703.426 436.197 1996.000 808.836 1703.426 439.260 1993.700 809.863 1703.426 442.325 1996.700 810.285 1703.426 445.358 1887.600 799.871 1619.371 448.431 1993.800 800.898 1619.371 451.475 1988.100 801.156 1619.371 454.522 1929.000 802.188 1619.371 457.558 1955.000 800.320 1603.488 460.598 1976.600 801.352 1603.488 463.634 1929.100 801.867 1603.488 466.672 1944.300 801.867 1603.488 469.712 1924.200 801.867 1603.488 472.751 1950.700 802.055 1604.051 475.787 1947.300 802.312 1604.051 478.820 1982.400 802.312 1604.051 481.856 1995.000 802.828 1604.051 484.891 1991.700 802.828 1604.051 487.936 1960.100 804.156 1621.258 490.971 1994.400 805.703 1621.258 494.001 1993.700 805.961 1621.258 497.036 1990.000 806.734 1621.258 500.072 1997.100 806.734 1621.258 503.120 1992.100 805.746 1621.723 506.132 1993.700 806.520 1621.723 509.184 1992.900 806.777 1621.723 512.222 1926.800 807.293 1621.723 515.251 1951.900 807.809 1621.723 518.270 1998.200 808.324 1621.723 521.281 1968.200 808.906 1622.652 524.320 1995.600 809.422 1622.652 527.357 1992.500 810.195 1622.652 530.408 1994.800 810.711 1622.652 533.448 1993.900 810.969 1622.652 536.465 1938.500 809.469 1622.980 539.512 1990.200 810.500 1622.980 542.549 1992.500 811.016 1622.980 545.591 1995.000 811.016 1622.980 548.629 1971.500 811.016 1622.980 551.667 1997.900 811.016 1622.980 554.676 1988.100 823.801 1648.457 557.720 1990.800 824.137 1648.457 560.757 1992.700 824.910 1648.457 563.795 1920.700 824.910 1648.457 566.833 1993.200 824.910 1648.457 569.869 1956.900 822.004 1548.469 572.903 1983.500 823.551 1548.469 575.929 1983.600 824.066 1548.469 578.962 1991.900 824.066 1548.469 582.000 1993.100 824.324 1548.469 585.035 1997.600 824.840 1548.469 588.065 1953.600 824.176 1565.566 591.102 1989.200 824.949 1565.566 594.140 1993.300 825.465 1565.566 597.169 1941.400 825.723 1565.566 600.199 1878.100 826.238 1565.566 603.235 1862.800 826.238 1565.566 606.251 1719.400 829.098 1565.934 609.288 1952.100 829.098 1565.934and the logging is:
Gurobi 12.0.0 (linux64, gurobi_cl) logging started Fri Jul 18 01:15:32 2025 Set parameter Username Set parameter LicenseID to value 2588209 Set parameter LogFile to value "gurobi.log" Using license file /home/x/gurobi.lic Academic license - for non-commercial use only - expires 2025-11-21 Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (linux64 - "Ubuntu 20.04.6 LTS") Copyright (c) 2024, Gurobi Optimization, LLC Read MPS format model from file point_mass_04_lt.mps Reading time = 0.01 seconds point_mass_dynamics: 15648 rows, 1450 columns, 40477 nonzeros Using Gurobi shared library /home/x/Desktop/gurobi1200/linux64/lib/libgurobi.so.12.0.0 CPU model: 12th Gen Intel(R) Core(TM) i7-12800H, instruction set [SSE2|AVX|AVX2] Thread count: 20 physical cores, 20 logical processors, using up to 20 threads Optimize a model with 15648 rows, 1450 columns and 40477 nonzeros Model fingerprint: 0x4efb2641 Model has 120 quadratic objective terms Variable types: 718 continuous, 732 integer (732 binary) Coefficient statistics: Matrix range [5e-01, 1e+01] Objective range [3e-02, 5e+00] QObjective range [2e-03, 2e-03] Bounds range [1e+00, 1e+01] RHS range [8e-01, 2e+01] Presolve removed 11773 rows and 257 columns Presolve time: 0.13s Presolved: 3875 rows, 1193 columns, 24877 nonzeros Presolved model has 120 quadratic objective terms Variable types: 276 continuous, 917 integer (915 binary) Found heuristic solution: objective 140.4603373 Root relaxation: objective 1.718720e+01, 7714 iterations, 0.31 seconds (0.35 work units) Nodes | Current Node | Objective Bounds | Work Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time 0 0 17.18720 0 324 140.46034 17.18720 87.8% - 0s H 0 0 67.8087150 17.18720 74.7% - 0s H 0 0 63.8678510 17.18720 73.1% - 0s 0 0 21.89667 0 420 63.86785 21.89667 65.7% - 2s 0 0 21.90367 0 422 63.86785 21.90367 65.7% - 2s 0 0 21.90367 0 423 63.86785 21.90367 65.7% - 2s 0 0 23.37362 0 396 63.86785 23.37362 63.4% - 2s 0 0 23.63118 0 410 63.86785 23.63118 63.0% - 3s 0 0 23.67372 0 399 63.86785 23.67372 62.9% - 3s 0 0 23.67387 0 383 63.86785 23.67387 62.9% - 3s 0 0 24.13219 0 424 63.86785 24.13219 62.2% - 3s 0 0 24.18598 0 432 63.86785 24.18598 62.1% - 3s 0 0 24.19227 0 433 63.86785 24.19227 62.1% - 3s 0 0 24.19340 0 432 63.86785 24.19340 62.1% - 3s 0 0 24.63381 0 426 63.86785 24.63381 61.4% - 4s 0 0 24.77164 0 436 63.86785 24.77164 61.2% - 4s 0 0 24.78921 0 436 63.86785 24.78921 61.2% - 4s 0 0 24.79793 0 433 63.86785 24.79793 61.2% - 4s 0 0 24.79831 0 436 63.86785 24.79831 61.2% - 4s 0 0 24.91398 0 437 63.86785 24.91398 61.0% - 4s 0 0 24.92806 0 426 63.86785 24.92806 61.0% - 4s 0 0 24.96065 0 428 63.86785 24.96065 60.9% - 4s 0 0 24.96213 0 435 63.86785 24.96213 60.9% - 4s 0 0 25.45747 0 441 63.86785 25.45747 60.1% - 5s 0 0 25.45747 0 449 63.86785 25.45747 60.1% - 5s 0 0 25.45747 0 453 63.86785 25.45747 60.1% - 5s 0 0 25.62320 0 449 63.86785 25.62320 59.9% - 5s 0 0 25.67841 0 472 63.86785 25.67841 59.8% - 5s 0 0 25.68568 0 462 63.86785 25.68568 59.8% - 5s 0 0 25.68735 0 465 63.86785 25.68735 59.8% - 6s 0 0 25.96686 0 484 63.86785 25.96686 59.3% - 6s 0 0 26.02022 0 478 63.86785 26.02022 59.3% - 6s 0 0 26.02650 0 479 63.86785 26.02650 59.2% - 6s 0 0 26.02769 0 482 63.86785 26.02769 59.2% - 6s 0 0 26.12200 0 478 63.86785 26.12200 59.1% - 7s 0 0 26.13119 0 487 63.86785 26.13119 59.1% - 7s 0 0 26.13689 0 485 63.86785 26.13689 59.1% - 7s 0 0 26.13732 0 487 63.86785 26.13732 59.1% - 7s 0 0 26.19600 0 475 63.86785 26.19600 59.0% - 7s 0 0 26.21484 0 469 63.86785 26.21484 59.0% - 7s 0 0 26.21696 0 470 63.86785 26.21696 59.0% - 7s 0 0 26.31771 0 467 63.86785 26.31771 58.8% - 8s 0 0 26.32344 0 461 63.86785 26.32344 58.8% - 8s 0 0 26.32382 0 468 63.86785 26.32382 58.8% - 8s 0 0 26.32853 0 469 63.86785 26.32853 58.8% - 9s 0 0 26.32927 0 470 63.86785 26.32927 58.8% - 9s 0 0 26.35555 0 476 63.86785 26.35555 58.7% - 9s 0 0 32.37325 0 509 63.86785 32.37325 49.3% - 10s 0 2 32.37369 0 509 63.86785 32.37369 49.3% - 11s 31 48 38.32699 5 231 63.86785 33.29116 47.9% 3273 16s 338 323 43.51852 21 135 63.86785 33.70090 47.2% 1236 20s 664 534 53.28675 37 94 63.86785 34.01076 46.7% 1002 25s 1141 910 48.96469 25 152 63.86785 34.13750 46.5% 843 30s 1724 1263 57.59417 39 82 63.86785 34.56473 45.9% 782 35s 2403 1664 40.95249 11 224 63.86785 34.86180 45.4% 749 41s 3067 2032 49.65169 19 233 63.86785 34.97423 45.2% 716 45s 3464 2137 56.66042 32 388 63.86785 35.26664 44.8% 704 51s 3469 2141 48.54136 18 496 63.86785 35.26664 44.8% 703 58s 3471 2142 57.59039 18 519 63.86785 35.48793 44.4% 703 60s 3474 2144 41.23322 12 524 63.86785 36.25995 43.2% 702 65s 3476 2145 36.78271 14 528 63.86785 36.63182 42.6% 702 70s 3480 2148 51.98128 30 522 63.86785 37.19849 41.8% 701 76s 3483 2150 43.84142 19 532 63.86785 37.19994 41.8% 700 83s 3485 2151 41.90545 19 536 63.86785 37.19994 41.8% 700 85s 3486 2152 60.52338 40 533 63.86785 37.26608 41.7% 700 91s 3490 2155 56.86293 26 537 63.86785 37.40027 41.4% 699 98s 3491 2155 38.54474 18 513 63.86785 37.58166 41.2% 699 100s 3499 2161 50.75032 21 529 63.86785 37.58194 41.2% 697 105s 3514 2188 39.28432 13 333 63.86785 38.09512 40.4% 770 111s 3622 2265 50.02841 16 160 63.86785 38.25277 40.1% 817 116s 3852 2278 cutoff 21 63.86785 38.25277 40.1% 827 120s 4044 2321 50.11201 21 108 63.86785 39.11427 38.8% 832 125s 4280 2363 58.79888 35 100 63.86785 39.67330 37.9% 834 130s 4514 2385 cutoff 23 63.86785 40.17227 37.1% 841 136s 4646 2397 cutoff 21 63.86785 40.17227 37.1% 844 140s 4957 2431 46.76207 25 241 63.86785 41.91116 34.4% 848 146s 5229 2441 47.87297 28 170 63.86785 41.92277 34.4% 854 151s 5494 2501 59.98963 40 76 63.86785 42.37594 33.7% 851 158s 5649 2524 infeasible 46 63.86785 43.14516 32.4% 846 162s 5818 2530 52.52393 24 126 63.86785 43.33891 32.1% 843 168s 6032 2529 58.67086 28 47 63.86785 43.96566 31.2% 836 172s 6263 2530 52.07536 22 209 63.86785 44.16235 30.9% 828 177s 6504 2529 63.32533 29 113 63.86785 45.10878 29.4% 820 182s 6726 2537 48.49992 19 277 63.86785 45.78134 28.3% 814 187s 6940 2531 cutoff 22 63.86785 46.38306 27.4% 810 191s 7180 2538 58.03193 23 147 63.86785 46.64592 27.0% 806 196s 7444 2533 59.64547 27 122 63.86785 47.19906 26.1% 800 202s 7724 2519 56.49735 20 189 63.86785 47.33644 25.9% 791 207s 7961 2487 62.05249 33 38 63.86785 47.44175 25.7% 790 213s 8080 2512 58.99039 29 192 63.86785 47.44175 25.7% 789 219s 8317 2509 49.13403 35 199 63.86785 47.44175 25.7% 787 225s 8598 2486 53.47846 40 70 63.86785 47.64373 25.4% 782 232s 8907 2456 cutoff 47 63.86785 47.98975 24.9% 777 239s 9231 2448 infeasible 39 63.86785 48.42356 24.2% 773 246s 9527 2443 55.12438 30 120 63.86785 48.47829 24.1% 770 253s 9916 2414 cutoff 23 63.86785 48.79931 23.6% 763 260s 10317 2460 cutoff 36 63.86785 49.08310 23.1% 756 268s 10767 2522 57.45997 18 205 63.86785 49.14547 23.1% 749 276s 11210 2602 56.87991 38 140 63.86785 49.35712 22.7% 743 285s 11688 2701 62.89651 29 86 63.86785 49.35712 22.7% 734 293s 12208 2787 cutoff 32 63.86785 50.03756 21.7% 725 301s 12680 2855 62.14800 28 96 63.86785 50.36781 21.1% 721 310s 13238 2868 58.35271 25 171 63.86785 50.73412 20.6% 715 320s 13267 2878 58.94874 26 166 63.86785 50.87693 20.3% 716 328s 13299 2885 59.29711 27 151 63.86785 50.87693 20.3% 716 336s 13355 2892 60.38186 28 146 63.86785 50.87693 20.3% 715 345s 13468 2927 57.45754 24 203 63.86785 50.88046 20.3% 714 354s 13737 2986 cutoff 29 63.86785 50.94068 20.2% 713 364s 14181 3043 cutoff 22 63.86785 50.97338 20.2% 707 374s 14699 3128 56.38866 24 169 63.86785 51.36906 19.6% 700 381s 15226 3224 cutoff 38 63.86785 51.81864 18.9% 695 385s 16574 3372 59.35245 32 48 63.86785 52.41819 17.9% 684 393s 17342 3424 cutoff 29 63.86785 52.80103 17.3% 678 400s 18163 3478 60.88600 28 67 63.86785 53.21591 16.7% 671 414s 19011 3493 61.50828 32 52 63.86785 53.34216 16.5% 664 428s 19893 3532 61.90948 31 71 63.86785 53.77858 15.8% 658 442s 20841 3511 62.48982 20 185 63.86785 54.10679 15.3% 650 456s 21771 3481 cutoff 25 63.86785 54.42099 14.8% 644 472s 22672 3459 58.69102 27 194 63.86785 54.89699 14.0% 641 487s 23671 3368 61.57478 37 48 63.86785 55.34619 13.3% 635 502s 24730 3256 cutoff 39 63.86785 55.78922 12.6% 629 518s 25759 3051 cutoff 34 63.86785 56.08419 12.2% 624 534s 26787 2808 60.97576 40 40 63.86785 56.78812 11.1% 621 551s 27918 2457 cutoff 29 63.86785 57.52080 9.94% 616 569s 29209 1831 cutoff 39 63.86785 58.17829 8.91% 609 587s 30535 858 cutoff 29 63.86785 58.98726 7.64% 602 605s 32094 0 cutoff 30 63.86785 60.38555 5.45% 590 610s Cutting planes: Learned: 4 Cover: 590 Implied bound: 201 Projected implied bound: 2 Clique: 34 MIR: 463 StrongCG: 77 Flow cover: 689 GUB cover: 39 Inf proof: 2 Zero half: 52 RLT: 101 Relax-and-lift: 124 BQP: 5 PSD: 3 Explored 33015 nodes (19183583 simplex iterations) in 610.76 seconds (350.67 work units) Thread count was 20 (of 20 available processors) Solution count 3: 63.8679 67.8087 140.46 Optimal solution found (tolerance 1.00e-04) Best objective 6.386785104762e+01, best bound 6.386785104762e+01, gap 0.0000%The process eventually use a bit more memory. Do you think it can be attributed to more constraints and larger number of non-zeros, or it is just a result of longer solving time?
- Xuan Lin
0 -
Do you think it can be attributed to more constraints and larger number of non-zeros, or it is just a result of longer solving time?
Both. Larger model means more memory to store it, more unexplored nodes means more model states to store, and longer runtime often means more unexplored nodes.
- Riley
0
Please sign in to leave a comment.
Comments
7 comments