Pyomo - Location of Log Files

扶醉桌前 提交于 2019-12-24 18:30:06

问题


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.

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


回答1:


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.

You can also log the file with a specific name, using

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


来源:https://stackoverflow.com/questions/56606881/pyomo-location-of-log-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!