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:

Code: Select all

```
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:

Code: Select all

```
Cost.. - (765265.268307277)*p(1) - (536401.504138218)*p(2)
- (577700.306546382)*p(3) + (0)*askPrice(1) + (0)*askPrice(2)
+ (0)*askPrice(3) + C =E= 0 ; (LHS = 0)
```

All suggestions how to fix this are highly appreciated, thank you in advance!

Best regards,

Hermann