how to set value only for a parameter's first dimension

Problems with syntax of GAMS
Post Reply
joe_sonic
User
User
Posts: 1
Joined: 5 years ago

how to set value only for a parameter's first dimension

Post by joe_sonic »

I have a parameter, say demand, which is over two dimensions
Set t;
Set usage /elc, gas/;
Parameter demand(t,usage);
$include test.inc

Now, I want to create a .inc file, where I want to set value for demand, BUT, at first only for 'elc'. I tried this:

*test.inc...
Parameter demand(t,'elc')
\
1 1.0
2 2.0
3 3.0
... (skipped)
1200 1200.0
\;

however, it doesn't work. Can some one kindly tell me what is the correct syntax?
Thanks!
Fred
Posts: 372
Joined: 7 years ago

Re: how to set value only for a parameter's first dimension

Post by Fred »

Hi,

Your code snippet has so many flaws, that I think it might be a good idea if you look at introductory material like the tutorial first: https://www.gams.com/latest/docs/UG_Tutorial.html

If you want to define values for parameter demand for 'elc' only, you could do this for example as follows:

Code: Select all

parameter demand(t,usage) /
1.'elc' 1.0
2.'elc' 2.0
3.'elc' 3.0
/;
I hope this helps!

Fred
Post Reply