Gurobi 和 java 以及空解决方案
我使用 Gurobi 和 java 来解决 ILP 问题。 我设置好所有内容并启动程序。但 Gurobi 甚至没有尝试解决我的问题,而是给了我一个空的解决方案,所有变量设置为 0。
在宽松的步骤中,Gurobi 显示函数的最小值是 -246。这与下一步相反,gurobi 显示最优解为 0。Gurobi
的输出为:
Optimize a model with 8189 rows, 3970 columns and 15011 nonzeros
Variable types: 0 continuous, 3970 integer (0 binary)
0 0 0 1.0E100 -1.0E100 0 0
**** New solution at node 0, obj 0.0
Found heuristic solution: objective 0.0000000
Root relaxation: objective -2.465000e+02, 4288 iterations, 0.08 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 -246.50000 0 315 0.00000 -246.50000 - - 0s
Cutting planes:
MIR: 907
Explored 0 nodes (5485 simplex iterations) in 0.70 seconds
Thread count was 1 (of 1 available processors)
Optimal solution found (tolerance 1.00e-04)
Best objective 0.000000000000e+00, best bound 0.000000000000e+00, gap 0.0%
I'm using Gurobi with java to solve a ILP problem.
I set all and I start the program. But Gurobi doesn't even try to solve my problem and gives my an empty solution all variable set to 0.
During the relaxed step Gurobi shows that the minimum value for the function is -246. This is in contrast with the next step were gurobi shows that the optimal solution is 0.
The output of Gurobi is:
Optimize a model with 8189 rows, 3970 columns and 15011 nonzeros
Variable types: 0 continuous, 3970 integer (0 binary)
0 0 0 1.0E100 -1.0E100 0 0
**** New solution at node 0, obj 0.0
Found heuristic solution: objective 0.0000000
Root relaxation: objective -2.465000e+02, 4288 iterations, 0.08 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 -246.50000 0 315 0.00000 -246.50000 - - 0s
Cutting planes:
MIR: 907
Explored 0 nodes (5485 simplex iterations) in 0.70 seconds
Thread count was 1 (of 1 available processors)
Optimal solution found (tolerance 1.00e-04)
Best objective 0.000000000000e+00, best bound 0.000000000000e+00, gap 0.0%
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Gurobi 报告称,它找到了最佳解决方案。所有变量值为 0 的解是最佳解(它不是“空解”)。目标为 -246.5 的解决方案适用于松弛问题。宽松的问题忽略了强制变量采用整数值的约束。目标值为 0 的解决方案是您制定的原始问题的解决方案。
您报告的症状(您显然不想要的全 0 解决方案)可能是由反向目标函数引起的。您是否可能想要最大化而不是最小化?
Gurobi is reporting that it found an optimal solution. The solution with values of 0 for all the variables is optimal (it's not an "empty solution"). The solution with objective -246.5 is for the relaxed problem. The relaxed problem ignores the constraints forcing variables to take on integer values. The solution with objective value of 0 is the solution to the original problem as you formulated it.
The symptoms you are reporting (an all 0 solution that you clearly don't want) is possibly caused by an inverted objective function. Is it possible that you wanted to maximize instead of minimize?