Pyomo - 日志文件的位置
Pyomo - Location of Log Files
非常基本的问题,但是我在哪里可以找到 Pyomo 的求解器日志文件?我在 Ubuntu 机器上本地安装了 COIN-OR 求解器。
这是在 Jupyter notebook 中发生的,但是当我从终端 运行 .py 文件时收到相同的错误消息。
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
要保留求解器日志文件,您需要在调用模型求解时指定要保留它们。
opt.solve(model, tee=True, keepfiles=True)
生成的文件将位于您的主要可执行文件旁边。
您还可以使用特定名称记录文件,使用
opt.solve(model, tee=True, logfile="some_file_name.log")
非常基本的问题,但是我在哪里可以找到 Pyomo 的求解器日志文件?我在 Ubuntu 机器上本地安装了 COIN-OR 求解器。
这是在 Jupyter notebook 中发生的,但是当我从终端 运行 .py 文件时收到相同的错误消息。
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
要保留求解器日志文件,您需要在调用模型求解时指定要保留它们。
opt.solve(model, tee=True, keepfiles=True)
生成的文件将位于您的主要可执行文件旁边。
您还可以使用特定名称记录文件,使用
opt.solve(model, tee=True, logfile="some_file_name.log")