Solver(ipopt)无法正常退出-python / jupyter / ubuntu

时间:2020-07-30 08:28:15

标签: python nonlinear-optimization ipopt

我正在尝试在ubuntu上使用python和jupyter notebook解决pyomo模型。为了解决这个问题,我使用了名为“ Ipopt”的求解器,因为我的问题是非线性的。但这每次都会给我这个错误。我已经尝试了一切,但仍无法解决。

ERROR: Solver (ipopt) returned non-zero return code (-11)
ERROR: See the solver log above for diagnostic information.

ApplicationError:

Traceback (most recent call last)<ipython-input-76-287a30c5476c> in <module> 
      
          3 opt = SolverFactory('ipopt',executable='/usr/local/bin/ipopt')

    ----> 4 results = opt.solve(model,tee=True)
    

     ~/project/my_project_env/lib/python3.6/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
    598                     logger.error("Solver log:\n" + str(_status.log))
    599                 raise pyutilib.common.ApplicationError(
    --> 600                     "Solver (%s) did not exit normally" % self.name)
    601             solve_completion_time = time.time()
    602             if self._report_timing:

    ApplicationError: Solver (ipopt) did not exit normally

从哪里可以查看求解器日志?还是可以使用pyomo ??

来解决非线性问题的任何其他求解器

1 个答案:

答案 0 :(得分:0)

在检查了可能的IPOPT options并阅读了有关如何设置求解器选项的pyomo文档后,假设solver是您的求解器(由SolverFactory创建)的处理程序,我将按以下步骤进行操作:

solver.options['print_level'] = 12
solver.options['output_file'] = "/home/your_user/my_ipopt_log.txt"

这样,您可以完全控制日志文件的创建位置。根据IPOPT的文档,值12表示最大日志级别:此整数选项的有效范围是0≤print_level≤12,其默认值为5