为啥不考虑 cplex 中解决方案数量的限制?
Posted
技术标签:
【中文标题】为啥不考虑 cplex 中解决方案数量的限制?【英文标题】:Why the limits of the number of solutions in cplex is not taken into consideration?为什么不考虑 cplex 中解决方案数量的限制? 【发布时间】:2021-05-20 16:03:10 【问题描述】:我正在使用从 Julia JuMP 包调用的 CPLEX 解决 MILP 问题。 在 CPLEX 日志中,解的数量显示为超过 3000,但参数 CPXPARAM_MIP_Limits_Solutions 设置为 55,因此当解的数量超过 55 时,求解器应返回。 解数爆炸导致内存不足错误,因此Linux内核杀死进程。
这是日志:
CPXPARAM_Emphasis_Memory 1
CPXPARAM_Emphasis_MIP 2
CPXPARAM_MIP_Limits_Solutions 55
CPXPARAM_TimeLimit 60
Warning: Non-integral bounds for integer variables rounded.
2 of 3 MIP starts provided solutions.
MIP start 'm1' defined initial solution with objective 0.0000.
Warning: Non-integral bounds for integer variables rounded.
Tried aggregator 2 times.
MIP Presolve eliminated 12094 rows and 182224 columns.
MIP Presolve added 26 rows and 0 columns.
MIP Presolve modified 17428 coefficients.
Aggregator did 1 substitutions.
Reduced MIP has 5863 rows, 4313 columns, and 28322 nonzeros.
Reduced MIP has 4132 binaries, 175 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.35 sec. (311.81 ticks)
Probing fixed 3059 vars, tightened 200 bounds.
Probing changed sense of 57 constraints.
Probing time = 0.45 sec. (324.14 ticks)
Cover probing fixed 0 vars, tightened 286 bounds.
Tried aggregator 2 times.
MIP Presolve eliminated 4435 rows and 3257 columns.
MIP Presolve modified 923 coefficients.
Aggregator did 2 substitutions.
Reduced MIP has 1426 rows, 1054 columns, and 7403 nonzeros.
Reduced MIP has 929 binaries, 122 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.02 sec. (19.58 ticks)
Probing time = 0.03 sec. (18.90 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 5 rows and 3 columns.
MIP Presolve modified 1 coefficients.
Reduced MIP has 1421 rows, 1051 columns, and 7378 nonzeros.
Reduced MIP has 927 binaries, 121 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.01 sec. (7.48 ticks)
Probing time = 0.08 sec. (52.47 ticks)
Clique table members: 6451.
MIP emphasis: optimality.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 32 threads.
Root relaxation solution time = 0.02 sec. (14.70 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0+ 0 0.0000 -106269.5431 ---
0 0 -463.9717 61 0.0000 -463.9717 480 ---
0 0 -454.9015 109 0.0000 Cuts: 86 537 ---
0 0 -434.5372 112 0.0000 Cuts: 87 592 ---
0 0 -426.6747 113 0.0000 Cuts: 97 622 ---
0 0 -418.6204 136 0.0000 Cuts: 62 660 ---
0 0 -413.7867 132 0.0000 Cuts: 55 698 ---
0 0 -409.6387 140 0.0000 Cuts: 16 721 ---
0 0 -407.9923 135 0.0000 Cuts: 39 739 ---
0 0 -407.0012 148 0.0000 Cuts: 34 760 ---
0 0 -406.3034 149 0.0000 Cuts: 11 775 ---
0 0 -405.7757 134 0.0000 Cuts: 17 784 ---
0 0 -405.4831 148 0.0000 Cuts: 59 804 ---
0 2 -405.4831 145 0.0000 -118.6877 804 ---
Elapsed time = 2.12 sec. (1148.70 ticks, tree = 0.02 MB, solutions = 2)
* 282 17 integral 0 0.0000 -118.6877 3889 ---
6415 1365 -0.0974 1 0.0000 -0.1947 20809 ---
11118 1933 -348.8038 138 0.0000 -0.1947 37285 ---
* 11185 11 integral 0 0.0000 -0.1947 37522 ---
* 11206 16 integral 0 -0.0000 -0.1947 37594 ---
12049 384 -0.0974 1 -0.0000 -0.1947 39994 ---
13976 1504 -0.0974 1 -0.0000 -0.1947 44560 ---
15081 1894 -0.0974 1 -0.0000 -0.1947 47408 ---
16098 2205 -0.0000 0 -0.0000 -0.1947 49781 ---
17468 2844 -0.0974 1 -0.0000 -0.1947 52969 ---
18578 3322 -0.0000 0 -0.0000 -0.1947 56013 ---
19990 1939 -0.0000 0 -0.0000 -0.1947 61970 ---
Elapsed time = 14.88 sec. (4728.96 ticks, tree = 2.14 MB, solutions = 3127)
21354 555 cutoff -0.0000 -0.1947 67537 ---
26500 824 -0.0974 1 -0.0000 -0.1431 79682 ---
Killed
版本:
CPLEX 12.9.0 朱莉娅 1.2.0 跳跃 0.20.1
编辑:
CPXPARAM_MIP_Limits_Solutions 参数控制在停止优化之前要找到的现有解决方案的最大数量。然而,这个数字不足以控制求解器保存在内存中的解的数量,因为可能存在多个解在目标函数值方面相等的情况,在这种情况下,它们只是计数对于CPXPARAM_MIP_Limits_Solutions 目的的一种解决方案。因此,为了避免求解器存储的解决方案导致的内存消耗,正确的参数是 CPXPARAM_MIP_Pool_Capacity(控制求解器探索的解决方案的数量),我将其设置为 0(因为我对取回探索的所有解决方案不感兴趣由 CPLEX 提供,但只是最好的)。 完成此配置后,程序在没有被内核杀死的情况下终止了运行。
【问题讨论】:
【参考方案1】:解决方案的数量很可能不是内存不足错误的原因。它是分支定界树的大小和需要存储和处理的节点数。您应该尝试限制用于减少内存占用的线程数。
此外,没有找到很多合适的解决方案。对于每个新的在职者,您会在相应行的开头看到一个标记(*
或 H
),例如,
* 282 17 integral 0 0.0000 -118.6877 3889 ---
6415 1365 -0.0974 1 0.0000 -0.1947 20809 ---
11118 1933 -348.8038 138 0.0000 -0.1947 37285 ---
* 11185 11 integral 0 0.0000 -0.1947 37522 ---
* 11206 16 integral 0 -0.0000 -0.1947 37594 ---
12049 384 -0.0974 1 -0.0000 -0.1947 39994 ---
我不知道日志中报告的解决方案数量指的是什么。可能这些是无法改善目标的额外解决方案。
请注意CPLEX docu中参数CPXPARAM_MIP_Limits_Solutions的描述:
设置停止前要找到的 MIP 解决方案的数量。
此整数解决方案限制不适用于生成解决方案以存储在解决方案池中的填充过程。关于 populate 生成的解决方案数量的限制,请参阅填充限制参数:populate 为解决方案池生成的解决方案的最大数量。
您可能还想查看CPXPARAM_MIP_Limits_Populate parameter。
【讨论】:
以上是关于为啥不考虑 cplex 中解决方案数量的限制?的主要内容,如果未能解决你的问题,请参考以下文章
为啥我在使用 CPLEX 的 Pyomo 中出现不允许的字符错误?
您好,我看到你之前提的cplex无法启动的问题,您解决了吗?我也遇到同样的问题,不知道怎么办