gpt4 book ai didi

python - GLPK 整数优化器打印 "PROBLEX HAS NO INTEGER FEASIBLE SOLUTION"但仍返回最佳状态

转载 作者:太空宇宙 更新时间:2023-11-03 19:12:02 24 4
gpt4 key购买 nike

需要有关 GLPK 输出的帮助。某些限制无法满足(故意)GLPK 打印“问题没有完整可行的解决方案”但仍然返回“最佳”作为解决方案的状态。

我已将所有容差级别设置为 0

glpk.options['feastol']=0
solvers.options['feastol']=0
glpk.options['abstol']=0
solvers.options['abstol']=0
glpk.options['reltol']=0
solvers.options['reltol']=0

这是输出

   GLPK Integer Optimizer, v4.43
10 rows, 5 columns, 19 non-zeros
5 integer variables, none of which are binary
Preprocessing...
1 hidden covering inequaliti(es) were detected
5 rows, 5 columns, 14 non-zeros
5 integer variables, all of which are binary
Scaling...
A: min|aij| = 1.000e+00 max|aij| = 1.000e+00 ratio = 1.000e+00
Problem data seem to be well scaled
Constructing initial basis...
Size of triangular part = 4
Solving LP relaxation...
GLPK Simplex Optimizer, v4.43
5 rows, 5 columns, 14 non-zeros
0: obj = 2.000000000e+00 infeas = 1.000e+00 (1)
* 2: obj = -2.500000000e+00 infeas = 0.000e+00 (0)
* 3: obj = -4.000000000e+00 infeas = 0.000e+00 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 3: mip = not found yet >= -inf (1; 0)
+ 3: mip = not found yet >= tree is empty (0; 1)
PROBLEM HAS NO INTEGER FEASIBLE SOLUTION

所需的行为是在“问题没有完整的可行解决方案”时指示失败

谢谢。

最佳答案

我只知道 C API,但我想您可以轻松找出等效的 Python。

在 C API 中,您使用 glp_mip_status() ,在您的情况下您会得到 GLP_NOFEAS ,这意味着“问题没有整数可行解”。请参阅文档中的确定 MIP 解决方案的状态

我不会搞乱公差。

关于python - GLPK 整数优化器打印 "PROBLEX HAS NO INTEGER FEASIBLE SOLUTION"但仍返回最佳状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12660093/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com