I am trying to use a cumulative sum in one of my equations. This is what I am trying to achieve:

This is the relevant section of my current code:

set
i=/1*3/;
alias(i,j);
Parameters
CPRL(i) Production cost for given week and given partition [EUR] /1 456939.268307277
2 459320.004138218
3 462078.056546382/;
PRL(i) PRL in given partition [MW] /1 8
2 1
3 1/;
Variables
p(i)
askPrice(i);
Cost .. C =e= sum(i,(p(i)*(CPRL(i) + sum(j$(ord(j) le ord(i)),PRL(i)*askPrice(i)))));

Sadly, the lst file output has very little in common with what I was hoping to see:

Gams collects all the information on the equation, linearizes it (if non-linear), and moves all variables and constants to the left.
If you have an equation like “aP1 + bP2 =E= c*P1” this will appear as:
(a-c)P1 + bP2 =E= 0;

If you are not sure, if your code is right, you should use “simple” numbers and check the values accordingly. Here is some of your code

set
i /1*3/;
alias(i,j);
Parameters
CPRL(i) Production cost for given week and given partition [EUR] /1 1
2 1
3 1/,
PRL(i) PRL in given partition [MW] /1 1
2 1
3 1/;
Variables
p(i)
C
askPrice(i);
equations cost;
Cost.. C =e= sum(i, ( p(i) * (CPRL(i) + sum(j$(ord(j) le ord(i)), PRL(i) * askPrice(i))));
model test /all/;
P.L(i) = 1; askprice.L(i) = 1;
test.iterlim = 0;
solve test minimizing C using NLP;

thank you very much for your response. I am afraid that my problem description was not accurate enough: the LHS/RHS notation GAMS uses is not the issue (I hope), but I am struggling to transform the equation I have jotted down on paper into correct GAMS code. For your example with simple values, the “paper version” can be found in the attached .png file.

Oh boy … I just realised that GAMS does not display multiplications of variables - instead, subsequent variables are replaced by their initial values! It all makes sense now.

Thank you very much, Renger, this has been a valuable lesson.

To be precise, GAMS displays the linearization of the expression. Since you have multiplication, that linearization will involve the level values for some variables, but that’s only because of the product rule for derivatives.

If you have exp(2x) + exp(3y) =L= 10; you will not see anything that looks like a level value in the equation listing.