Pyomo 访问求解器状态

问题描述

我正在使用 Pyomo 和 Scip 作为求解器求解 MINLP。 问题解决后我自动得到这个输出

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 13.00
Solving Nodes      : 1845
Primal Bound       : +5.21506487017157e+03 (26 solutions)
Dual Bound         : +5.21506487017157e+03
Gap                : 0.00 %

我想保存这个输出的值。随着求解时间,它的工作方式如下:

results = opt.solve(instance)
Time = results.solver.time

但是,如果我对 Gap 尝试相同的方法,并且节点会出现错误

AttributeError: UnkNown attribute `gap' for object with type <class 'pyomo.opt.results.solver.solverinformation'>

我也试过使用:

GAP = results.solution.gap

这会导致输出未定义。

有没有其他方法可以访问这两个值。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)