Sum over hours for years with an increase of Values

Problems with syntax of GAMS
Post Reply
TheBebbo
User
User
Posts: 16
Joined: 2 years ago

Sum over hours for years with an increase of Values

Post by TheBebbo »

Hey people,

i want to maximize the profit over an investment for 20 years.

So far I have the objective function for 1 year over 8760 hours.

Set
t time in hours /1*8760/;

Scalar
θ /0,2/;

Parameters
Prce(t)
Price2(t)
Example1(t)
Example2(t)
SC(t)
X(t)
Y(t)
Z(t)
B(t);

$gdxIn Values_2004.gdx
$LOAD Price1, Price2, Example1, Example2
$gdxIn


Equation
OBJ Objektive function;
OBJ..
G=E= sum(t, x(t) * Price1(t) + Y(t) * Price2(t) + Z(t) * Price1(t) - B(t) * price1(t));

Equation
C1 constraint
C1(t).. SC(t) =e= (Y(t) + R(T) ) * θ;


So far it works and I have the correct solution for the first year. (Its only a part of my code)
But I want to include for the following years a price increase of for example 2% for Price1 and for price 2.
I also want θ to increase by 10 % per Year.

So my problem ist to include the 20 years and not only one year in my calculation and to consider the increases of the values without changing the gdx file which includes only the values for the first year.

Thank you in advance.

Best greetings and stay safe
TheBebbo
Fred
Posts: 373
Joined: 7 years ago

Re: Sum over hours for years with an increase of Values

Post by Fred »

Hi Bebbo,

The following pseudo code may give you an idea how to proceed.

Code: Select all

set y years / y1*y20 /;
...
loop(y,
  solve myModel max G use <modeltype>;
* update data for next year
  Price1(t) = Price1(t)*1.02;   
  Price2(t) = Price2(t)*1.02;
  theta     = theta * 0.9
);  
I am bit confused by your example since it shows the objective function being calculated only from constants which makes the model trivial. But maybe this is just an (incomplete) example...

I hope this helps!

Fred
Post Reply