将解算器输出中的数据保存到Python中的列表中

将解算器输出中的数据保存到Python中的列表中,python,Python,在python中,当您运行解算器时,它会显示一些细节以及解决方案 例如,我使用了一个名为IPOPT的解算器,使用以下代码 solver = SolverFactory('ipopt') solver.solve(model, tee=True) 我从解算器中得到了以下输出: This is Ipopt version 3.11.1, running with linear solver mumps. Number of nonzeros in equality constraint Jaco

在python中,当您运行解算器时,它会显示一些细节以及解决方案

例如,我使用了一个名为IPOPT的解算器,使用以下代码

solver = SolverFactory('ipopt')
solver.solve(model, tee=True)
我从解算器中得到了以下输出:

This is Ipopt version 3.11.1, running with linear solver mumps.

Number of nonzeros in equality constraint Jacobian...:        6
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        3

Total number of variables............................:        4
                     variables with only lower bounds:        2
                variables with lower and upper bounds:        2
                     variables with only upper bounds:        0
Total number of equality constraints.................:        2
Total number of inequality constraints...............:        0


iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 2.0402000e+000 1.35e-002 1.00e+000  -1.0 0.00e+000    -  0.00e+000 0.00e+000   0
   1 2.2708093e+000 1.01e-001 1.38e-001  -1.0 1.72e+000    -  1.00e+000 1.00e+000f  1
   2 2.1698603e+000 2.96e-002 3.73e-002  -1.0 2.85e+000    -  1.00e+000 1.00e+000h  1
   3 2.0024980e+000 2.74e-001 4.00e-002  -2.5 4.47e+000    -  9.79e-001 9.85e-001h  1
   4 2.0056830e+000 1.35e-004 1.30e-004  -2.5 1.66e-001    -  1.00e+000 1.00e+000h  1
   5 2.0002989e+000 3.63e-006 3.17e-005  -3.8 2.68e-003    -  1.00e+000 1.00e+000h  1
   6 2.0000036e+000 1.09e-008 1.18e-007  -5.7 1.47e-004    -  1.00e+000 1.00e+000h  1
   7 2.0000000e+000 1.69e-012 1.73e-011  -8.6 1.84e-006    -  1.00e+000 1.00e+000h  1

现在从显示中,我想保存一些信息,例如,上表中的列到列表中。例如,从表中,我想要两个来自“iter”和“objective”列的列表

那么,有可能保存这些信息吗?有人能帮我做吗

事先非常感谢

大宗报价