Hi,
I need help with the correct syntax for element by element multiplication using GAMS. My shortcode is attached.
Element by Element Multplication in GAMS
Re: Element by Element Multplication in GAMS
Hi
Works fine for me, when I run your code after correcting some non-related errors. But perhaps you are looking for something else.
I attach the corrected version.
Cheers
Renger
Works fine for me, when I run your code after correcting some non-related errors. But perhaps you are looking for something else.
I attach the corrected version.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Element by Element Multplication in GAMS
Many thanks for your quick response. I want to apologize for not explaining my problem correctly. I would want to do the following.
Essentially, I would like to scale each hourly load by the factor in tscaling(ss)
So
Pd.t1 = ss1*Pd.
Pd.t2 =ss2*Pd
Pd.t3=ss3*Pd
Pd.t24=ss24*Pd
so I get a new Table BD(d,b,t,*) but original values scaled by tscaling(ss)
I attach my initial data set.
Re: Element by Element Multplication in GAMS
Hi
As both sets have the same number of elements (24), you can use a loop using the order of the elements.
For example, if you want to multiply Pd(t) with tscaling(ss), this would look like this:
I hope this helps
Renger
As both sets have the same number of elements (24), you can use a loop using the order of the elements.
For example, if you want to multiply Pd(t) with tscaling(ss), this would look like this:
Code: Select all
loop(t,
loop(ss$(ord(t) = ord(ss),
Pd(t) = Pd(t) * tscaling(ss);
);
);
I hope this helps
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Element by Element Multplication in GAMS
Why don't you just index the parameter tscaling() by t instead of ss? I.e. make it
parameter tscaling(t) /
t1 0.826
blah blah
/;
The set ss is not really helping you.
parameter tscaling(t) /
t1 0.826
blah blah
/;
The set ss is not really helping you.