微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

你如何在 Gekko 中使用 apm_get?

如何解决你如何在 Gekko 中使用 apm_get?

对 Gekko 输出进行故障排除时,如何访问 infeasibilities.txt 文件?我在用着 m = GEKKO(remote=False) 所以我不知道 serverapp 参数在 apm_get(server,app,'infeasibilities.txt') 函数中使用什么。

解决方法

如果您在公共服务器上使用 remote=True 求解,那么您可以从服务器检索文件。

from gekko.apm import get_file
print(m._server)
print(m._model_name)
f = get_file(m._server,m._model_name,'infeasibilities.txt')
f = f.decode().replace('\r','')
with open('infeasibilities.txt','w') as fl:
    fl.write(str(f))

如果您使用 remote=False 求解,则无需从服务器获取文件。它将在运行文件夹 m.path 中可用或使用 m.open_folder() 查看。有关 How to retrieve the 'infeasibilities.txt' from the gekko

的更多详细信息

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。