简体   繁体   中英

How do you use apm_get in Gekko?

When troubleshooting Gekko outputs, how do I access the infeasibilities.txt file? I'm using m = GEKKO(remote=False) so I don't know what to use for the server and app parameters in apm_get(server,app,'infeasibilities.txt') function.

If you are solving with remote=True on the public server then you can retrieve the file from the server.

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))

If you are solving with remote=False then there is no need to get the file from the server. It will be available in the run folder m.path or viewable with m.open_folder() . There are more details on How to retrieve the 'infeasibilities.txt' from the gekko

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM