Page 1 of 1

Python API: view solver output

Posted: Sun Apr 26, 2020 6:17 am
by davidwogan
Hi everyone,

I have a workflow running GAMS models using the Python 3.6 API. I am looking for a way to inspect the solver progress, the same way you would when running a GAMS job in the IDE. Is there a class or method in the Python API to enable this type of output? This will assist in debugging the model, etc.

This topic may be related to this previous topic viewtopic.php?f=10&t=9903&p=22605&hilit ... put#p22605. I also searched the Python API documentation https://www.gams.com/latest/docs/API_PY_TUTORIAL.html. Perhaps I missed the class reference. Thanks!

David

Re: Python API: view solver output

Posted: Mon Apr 27, 2020 6:52 am
by bussieck
David,

The GAMSJob.run method has an (optional) argument output. You pass in a stream, e.g. sys.stdout, and viola the GAMS log including the solver log appears on stdout. You can use other streams , including files to capture the log more permanently. This has been asked often enough that in the new GAMS 31 (currently in beta) we added a section to mention this explicitly: https://www.gams.com/beta/docs/API_PY_T ... PTION_FILE

-Michael

Re: Python API: view solver output

Posted: Tue Apr 28, 2020 5:11 am
by davidwogan
Michael,

Thank you for the pointer -- the output argument worked and is very convenient!

Many thanks,

David