Pyomo-日志文件的位置 [英] Pyomo - Location of Log Files

查看:129
本文介绍了Pyomo-日志文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个非常基本的问题,但是我在哪里可以找到Pyomo的求解器日志文件?我在Ubuntu机器上本地安装了COIN-OR解算器.

Pretty basic question, but where can I find solver log files from Pyomo? I have a local installation of the COIN-OR solvers on an Ubuntu machine.

这是在Jupyter笔记本中发生的,但是当我从终端运行.py文件时,我得到了相同的错误消息.

This is happening in a Jupyter notebook, but I'm getting the same error message when I run the .py file from terminal.

solverpath_exe='~/COIN-OR/bin/couenne' 
opt = SolverFactory('couenne', executable = solverpath_exe)
opt.solve(model,tee=True) 

---------------------------------------------------------------------------
ApplicationError                          Traceback (most recent call last)
<ipython-input-41-48380298846e> in <module>()
     29 #instance = model.create_instance()
     30 opt = SolverFactory('couenne', executable = solverpath_exe)
---> 31 opt.solve(model,tee=True)
     32 #solver=SolverFactory(solvername,executable=solverpath_exe)

/home/ralphasher/.local/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 (asl) did not exit normally

推荐答案

要保留求解器日志文件,您需要指定在调用模型求解时要保留它们.

To keep the solver log file, you need to specify that you want to keep them when calling for the solving of your model.

opt.solve(model, tee=True, keepfiles=True)

结果文件将在您的主要可执行文件旁边.

The resulting file will be next to your main executable.

您还可以使用

opt.solve(model, tee=True, logfile="some_file_name.log")

这篇关于Pyomo-日志文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆