Page 1 of 1

How to store the words in a set?

Posted: Wed Feb 20, 2019 5:27 pm
by patriciars
Hello.

For example in the code below:

Code: Select all

 Sets
           i source /REF/
          j demand /NHT1, NHT2, NHT3,LNIS, GHT/
          k purifiers /PSA1/;
I need to store the strings REF in set i, the strings NHT1, NHT2, NHT3,LNIS, GHT in set j and teh string PSA1 in set k.

How can I do this?

I need to get the words of each set because I need to make a matrix and this names are the columns.

Thank you for the help.

Re: How to store the words in a set?

Posted: Thu Feb 21, 2019 9:07 am
by Renger
Hi

I have the feeling that you might want to dig in the documentation on GAMS a little more (but I can be wrong).
What do you mean by storing? In an excel or text file? You can just save the sets to an excel file (see the documentation on gdxxrw). You could also read those "words" from an Excel sheet with a table.
Cheers
Renger

Re: How to store the words in a set?

Posted: Thu Feb 21, 2019 12:47 pm
by patriciars
Sorry, I forgot To write.
I’m working with Python.. using the gams api python.
I need To import the strings of the set. maybe create a vector with this words, something like this.