Search found 47 matches

by Clemens
2 days ago
Forum: API
Topic: GMSPython 3.7 and tkinter
Replies: 2
Views: 988

Re: GMSPython 3.7 and tkinter

Hello, There is currently no time schedule for updates of the Python version that is shipped with GAMS. It is primarily meant to be used as a minimal Python interpreter for certain GAMS features, especially the Embedded Code Python Facility. If there is a need for specific Python configurations, a s...
by Clemens
3 months ago
Forum: API
Topic: Python API Exception Handling
Replies: 5
Views: 466

Re: Python API Exception Handling

This is not possible right now. In order to get detailed information about an error it is required to have a look into the listing file or to examine the log output.

Best,
Clemens
by Clemens
3 months ago
Forum: API
Topic: Python API Exception Handling
Replies: 5
Views: 466

Re: Python API Exception Handling

The log output can be captured by specifying the output argument in GamsJob.run() . The following code snipped shows how to get the log output redirected to stdout: from gams import * import sys if __name__ == "__main__": if len(sys.argv) > 1: ws = GamsWorkspace(system_directory = sys.argv[1]) else:...
by Clemens
3 months ago
Forum: API
Topic: Python API Exception Handling
Replies: 5
Views: 466

Re: Python API Exception Handling

Hello, The GamsException itself as well as the GamsExceptionExecution do not give you detailed information about the cause of an error. You can use the GamsException.get_rc() call in order to get the return code of GAMS which tells you what kind of problem occurred. See the documentation for possibl...
by Clemens
4 months ago
Forum: API
Topic: Reusing a model instance in different function calls
Replies: 6
Views: 651

Re: Reusing a model instance in different function calls

Bruno, Sorry for the delay. It seems to me that you did solve your original problem where you did the mi.instantiate call multiple times. So from a GAMS/Python perspective the code looks actually correct to me. The new problem that arises now is that you also want to do some calculations in MatLab "...
by Clemens
5 months ago
Forum: API
Topic: Reusing a model instance in different function calls
Replies: 6
Views: 651

Re: Reusing a model instance in different function calls

Bruno, You do not have to call those methods multiple times. After you have instantiated your GamsModelinstance you have also defined the symbols that you want to change (GamsModifier). All you have to do is to change the data in your symbol (ySp) and call mi.solve(). Can you can provide a larger ex...
by Clemens
5 months ago
Forum: API
Topic: Reusing a model instance in different function calls
Replies: 6
Views: 651

Re: Reusing a model instance in different function calls

Bruno, You might want to have a look at the transport7.py example: https://www.gams.com/latest/docs/apis/examples_python/transport7_8py_source.html This shows how you can use the GamsModelinstance class. More information is available in the documentation: https://www.gams.com/latest/docs/apis/python...
by Clemens
6 months ago
Forum: API
Topic: gams_job.interrupt() does not work in Python 3.6
Replies: 3
Views: 503

Re: gams_job.interrupt() does not work in Python 3.6

Serdar,

This is actually a bug in the GAMS Python API. We have already fixed the bug and will publish it in the next GAMS release. Thank you very much for reporting this problem.

Best,
Clemens
by Clemens
7 months ago
Forum: API
Topic: Python API: Solving two models one after the other
Replies: 1
Views: 410

Re: Python API: Solving two models one after the other

Giorgis, It would be good if you can provide some code that demonstrates the problem. I assume that you are using GamsWorkspace.add_job_from_string() to create a GamsJob instance. This one can be executed using the run() method and should per default compile and execute all your GAMS code. Best, Cle...
by Clemens
9 months ago
Forum: API
Topic: Python Embedded in Gams - Import Python Package
Replies: 13
Views: 3474

Re: Python Embedded in Gams - Import Python Package

Renger, The mechanism on finding the Python interpreter is different on Linux. The shared object that is responsible for loading the Python interpreter uses @rpath to resolve its dependency to the Python shared object. Therefore it will be very hard to convince Embedded Code to use a different Pytho...