Query on the data structure and debug procedure in python Embedded Code Facility

questions about GAMS' tools
Post Reply
Jubeyer
User
User
Posts: 32
Joined: 1 year ago

Query on the data structure and debug procedure in python Embedded Code Facility

Post by Jubeyer » 2 months ago

Hi,
I have been trying to build a model with the EmbeddedCode Facility of GAMS with python. However, I am not getting a clear picture about the data structure that is going in and out from the embedded code section[https://www.gams.com/latest/docs/UG_EmbeddedCode.html]. So, I have few queries regarding this:
a.
For example,
I am passing this parameter to embedded code section
image.png
and reading it in the embedded code section as

profiles_source=gams.get('NUCLEAR_SCHEDULE')

can anyone tell me what is the python data structure that will be created as a result of this process (2-d DataFrame (matrix), array, list, etc.). [For this the error message looks like the one with question d]
b.
I have tried with this command as well:
profiles_source=list(gams.get('NUCLEAR_SCHEDULE')), so I want to know what will be the data structure in this case , I am guessing that this will be a list but what will happen to the indices?
[For this code the error is saying; setting an array element with sequence]

c. If I want to pass a numpy array from the embedded section to gams like this
image.png
, where the row indicates 'time' and 'column' indicates 'units' ; how should I declare this parameter in GAMS and if the 'units' have different names like 'unit 1, unit 2, .., etc. should I forcefully rename the columns with those names before passing this back to GAMS and will there be any conflict due to the indexing prcoess since python indexing starts from 0 whereas GAMS indexing may not start with zero (I am not sure about it).

d. Lastly, I am getting error messages like this
image.png
, can anyone suggest how to debug the python section since this type of message is not helpful at all to debug.
Note: I have separately tested my python script and that is working just fine.

Regards,
Jubeyer

Post Reply