How to create an index in GAMS Topic is solved

Problems with syntax of GAMS
Post Reply
anaaza
User
User
Posts: 8
Joined: 4 years ago

How to create an index in GAMS

Post by anaaza »

Hi,

Considering that I have two parameters:
Parameter1(a,b,c,"age")
Parameter2(a,b,c,"SiteIndex")

How can I create:
Parameter3(a,b,c,"age.SiteIndex")?

I mean, what I'm wondering is if there is a way of putting together both parameters creating a "unique" index, which I will use to extract value from a lookup table.
Ps.: I don't want to sum up both parameters, I simply want to "glue" them.

Any hints are more than welcome =)

Cheers,

Ana
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: How to create an index in GAMS

Post by Renger »

Hi Ana

You could just use one parameter:

Code: Select all

	age(a,b,c)  'Your original parameter1',
	siteIndex(a,b,c) 'Your original parameter2'
	allstuff(a,b,c,*)

allstuff(a,b,c,"Age') = age(a,b,c);
allstuff(a,b,c,"siteIndex") = siteIndex(a,b,c);
or like this:

Code: Select all

set d /"Age", "Index"):

parameters
age(a,b,c)  'Your original parameter1',
siteIndex(a,b,c) 'Your original parameter2'
allstuff(a,b,c,d)

allstuff(a,b,c,"Age') = age(a,b,c);
allstuff(a,b,c,"siteIndex") = siteIndex(a,b,c);
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply