Gekko error“未找到结果文件。APM未找到解决方案或服务器无法访问“

2024-06-17 12:10:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在这个网站上学习: https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization

我尝试了一些Gekko脚本,却得到了同样的错误:

     Successful solution

 ---------------------------------------------------
 Solver         :  APOPT (v1.0)
 Solution time  :   1.429999999527354E-002 sec
 Objective      :    17.0140172891559     
 Successful solution
 ---------------------------------------------------

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\gekko\gekko.py", line 2005, in solve
    results = byte2str(get_file(self._server,self._model_name,'results.json'))
  File "C:\Python35\lib\site-packages\gekko\apm.py", line 160, in get_file
    f = urllib.request.urlopen(url)
  File "C:\Python35\lib\urllib\request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python35\lib\urllib\request.py", line 472, in open
    response = meth(req, response)
  File "C:\Python35\lib\urllib\request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python35\lib\urllib\request.py", line 510, in error
    return self._call_chain(*args)
  File "C:\Python35\lib\urllib\request.py", line 444, in _call_chain
    result = func(*args)
  File "C:\Python35\lib\urllib\request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/CIVIL/LePy/le_Gekko1.py", line 44, in <module>
    m.solve()
  File "C:\Python35\lib\site-packages\gekko\gekko.py", line 2022, in solve
    raise ImportError('Results files not found. APM did not find a solution or the server is unreachable.')
ImportError: Results files not found. APM did not find a solution or the server is unreachable.

我怎样才能修好它? 谢谢您!在


Tags: inpyresponserequestlibpackageslinesite
1条回答
网友
1楼 · 发布于 2024-06-17 12:10:07

如果问题成功解决,但解决方案完成后出现错误,则很可能是从计算服务器检索解决方案文件时出现问题。如果将选项remote设置为False,则可以消除对远程服务器的依赖:

m = GEKKO(remote=False)

你可以看到结果.csv文件(解决方案文件)在运行目录中打开文件夹。在

^{pr2}$

相关问题 更多 >