Search found 61 matches

by Clemens
5 years ago
Forum: API
Topic: GAMS PYTHON API - INTERFACE JUPYTER
Replies: 7
Views: 9887

Re: GAMS PYTHON API - INTERFACE JUPYTER

You can not use ws.gamslib() for you custom models. You need to use ws.add_job_from_file in order to load a model from a specific file that you have created.

Best,
Clemens
by Clemens
5 years ago
Forum: API
Topic: GAMS API Python
Replies: 7
Views: 10543

Re: GAMS API Python

The content does not look like the content of the LST file (_gams_py_gjo0.lst). Please make sure that you are really looking at the LST file. I also saw some problems in your Python code. You call the GamsWorkspace constructor multiple times and make multiple assignments to ws . Please make sure tha...
by Clemens
5 years ago
Forum: API
Topic: GAMS PYTHON API - INTERFACE JUPYTER
Replies: 7
Views: 9887

Re: GAMS PYTHON API - INTERFACE JUPYTER

Hi, When calling the GamsWorkspace constructor, the API tries to find a valid GAMS system directory. The exact mechanism for this is depending on the operating system. If you want to specify a system directory explicitly you can do this by providing the named argument system_directory : GamsWorkspac...
by Clemens
5 years ago
Forum: API
Topic: GAMS API Python
Replies: 7
Views: 10543

Re: GAMS API Python

Hello, The ws.gamslib call tries to find the model Artigo_LJ1 in the GAMS Model Library and can not find it. If you want to create a GamsJob from a specific file you need to use ws.add_job_from_file (https://www.gams.com/latest/docs/apis/python/classgams_1_1workspace_1_1GamsWorkspace.html#af1e83abb0...
by Clemens
5 years ago
Forum: Tools
Topic: MySQL, GAMS and Unix
Replies: 3
Views: 3681

Re: MySQL, GAMS and Unix

Renger,

Neither the Object-Oriented Python API nor the Embedded Code facility is currently available for Python 3.7. At least the Object-Oriented API will (at some point of time) support Python 3.7. The Embedded Code facility might follow then.

Best,
Clemens
by Clemens
5 years ago
Forum: Tools
Topic: MySQL, GAMS and Unix
Replies: 3
Views: 3681

Re: MySQL, GAMS and Unix

Renger, Using Embedded Code is in my opinion a good idea. You save the extra Python file and you could do it without writing the CSV file. Something like this: parameter p(*,*); $onEmbeddedCode Python: import pandas as pd data = [('a', 'a', 2), ('a','b', 4), ('b', 'a', 1), ('b','b', 3)] df = pd.Data...
by Clemens
5 years ago
Forum: API
Topic: Embedded Python code - Import parameter with gams.get
Replies: 2
Views: 5372

Re: Embedded Python code - Import parameter with gams.get

Luis, First of all, note that the assignment ParA = 5; happens during GAMS execution time and the $onEmbeddedCode/$offEmbeddedCode section is performaned during GAMS compilation time. That means that in the embedded code section, no value will be assigned to ParA . For more information about GAMS ex...
by Clemens
5 years ago
Forum: API
Topic: Fastest interaction between GAMS and Python
Replies: 2
Views: 4962

Re: Fastest interaction between GAMS and Python

Serge, 1) Loading a model form string or from file is very unlikely to make any difference in terms of performance. In any case a GamsJob will result in a file containing the source code when the run() method is called. 2) This depends on your specific situation. If large parts of the GamsDatabase r...
by Clemens
5 years ago
Forum: API
Topic: GAMS API Python
Replies: 7
Views: 10543

Re: GAMS API Python

Then it was perhaps a mismatch in the version of the Python API and the Python interpreter. Both the bitness as well as the version (2.7, 3.6 etc) need to match. Good to hear that you got it working. You have probably seen the tutorial already, but in case you did not, here it is: https://www.gams.c...
by Clemens
5 years ago
Forum: API
Topic: GAMS API Python
Replies: 7
Views: 10543

Re: GAMS API Python

Hi, The error is most likely caused by a bitness mismatch of your GAMS version including the Python API and your version of Python itself. Please double check your Python version if it is really 32 bit by just launching the live interpreter on the command line and looking at the output. Regarding th...