Merge two variables, defined over two different sets, into a single variable defined over the merge of the sets

Dear members,



I’m new in programming on GAMS, so I’m not familiar with it.



I was reading some data from an xls spreadsheet, executing my model, and then writing back the results to another xls spreadsheet, but I had some problems on displaying the results on excel. I would like to use the “printing” options of GAMS using gdxxrw instead of using excel macros.



The problem is that I have some optimized variables defined over a set, say “non_hydro_facilities”, and another optimized variables defined over a set, say “hydro_facilities”. The variables are “NonHydroGeneration(i, j, non_hydro_facilities)” and “HydroGeneration(i, j, hydro_facilities)”, and I would love to use the gdxxrw utility to “print” the variables on a table that contains both variables sorted by the sets i and j. That means, I would love to create the variable

“Generation(i, j, facilities)”. I have already created the set “facilities”, merging the sets “non_hydro_facilities” and “hydro_facilities”. Is there any possibility to do what I describe above?

I would be very glad if someone could help me. Thanks in advance!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi,

Merging symbols with different domains is easy but definitely not obvious, you don’t even need the combined set facilities:

Parameter Generation(i, j, *);
Generation(i, j, non_hydro_facilities) = NonHydroGeneration.L(i, j, non_hydro_facilities);
Generation(i, j, hydro_facilities) = HydroGeneration.L(i, j, hydro_facilities);

The ‘’ in the symbol declaration represents the universe of all labels, so you don’t get a domain violation error when you use it with different sets in the same index position. Use '’ cautiously, domain checking is a great facility of GAMS to get help from the compiler to detect model errors.

Michael Bussieck - GAMSWorld Coordinator

On Tuesday, March 19, 2013 3:13:05 PM UTC-4, Cristobal Sarquis wrote:

Dear members,



I’m new in programming on GAMS, so I’m not familiar with it.



I was reading some data from an xls spreadsheet, executing my model, and then writing back the results to another xls spreadsheet, but I had some problems on displaying the results on excel. I would like to use the “printing” options of GAMS using gdxxrw instead of using excel macros.



The problem is that I have some optimized variables defined over a set, say “non_hydro_facilities”, and another optimized variables defined over a set, say “hydro_facilities”. The variables are “NonHydroGeneration(i, j, non_hydro_facilities)” and “HydroGeneration(i, j, hydro_facilities)”, and I would love to use the gdxxrw utility to “print” the variables on a table that contains both variables sorted by the sets i and j. That means, I would love to create the variable

“Generation(i, j, facilities)”. I have already created the set “facilities”, merging the sets “non_hydro_facilities” and “hydro_facilities”. Is there any possibility to do what I describe above?

I would be very glad if someone could help me. Thanks in advance!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\