How to transform this equation into GAMS language?

The equation is shown above

I input:

Equation(i,m)$im(i,m) … CPSO(i,m) =e= ( AHSO(i,m) - *** ) / ( DTSO(i)-ATSO(i,m) )
The asterisks is what I am not able to input. How can I express the ‘sum’ in GAMS that ‘i’ = ‘i-1’?
Thanks.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/LyLzzb68OZcJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Dylan



I assume that in the summation, you don’t want the member i not included and not sum until i-1. If this is the case, you could use



Alias(i , j);

Equation(i,m)im(i,m) .. CPSO(i,m) =e= ( AHSO(i,m) – sum(j(not sameas(j,i), DHS0(j) ) )/ ( DTSO(i)-ATSO(i,m) )

If you really want to sum until i-1, then you could write



Alias(i , j);

Equation(i,m)im(i,m) .. CPSO(i,m) =e= ( AHSO(i,m) – sum(j(ord(j) lt ord(i)), DHS0(j)) )/ ( DTSO(i)-ATSO(i,m) )



Cheers

Renger


\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

Info@modelworks.ch

blog.modelworks.ch







Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Dylan Lan
Gesendet: Montag, 21. Januar 2013 12:13
An: gamsworld@googlegroups.com
Betreff: How to transform this equation into GAMS language?



The equation is shown above

I input:

Equation(i,m)$im(i,m) … CPSO(i,m) =e= ( AHSO(i,m) - *** ) / ( DTSO(i)-ATSO(i,m) )

The asterisks is what I am not able to input. How can I express the ‘sum’ in GAMS that ‘i’ = ‘i-1’?

Thanks.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/LyLzzb68OZcJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thank you very much, your reply is helpful! I intended to sum until i-1 but I don’t know how. Thanks again.

在 2013年1月21日星期一UTC+8下午8时19分23秒,Renger van Nieuwkoop写道:

Hi Dylan



I assume that in the summation, you don’t want the member i not included and not sum until i-1. If this is the case, you could use



Alias(i , j);

Equation(i,m)im(i,m) .. CPSO(i,m) =e= ( AHSO(i,m) – sum(j(not sameas(j,i), DHS0(j) ) )/ ( DTSO(i)-ATSO(i,m) )

If you really want to sum until i-1, then you could write



Alias(i , j);

Equation(i,m)im(i,m) .. CPSO(i,m) =e= ( AHSO(i,m) – sum(j(ord(j) lt ord(i)), DHS0(j)) )/ ( DTSO(i)-ATSO(i,m) )



Cheers

Renger


\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

In…@modelworks.ch

blog.modelworks.ch







Von: gams...@googlegroups.com [mailto:gams...@googlegroups.com] Im Auftrag von Dylan Lan
Gesendet: Montag, 21. Januar 2013 12:13
An: gams...@googlegroups.com
Betreff: How to transform this equation into GAMS language?



The equation is shown above

I input:

Equation(i,m)$im(i,m) … CPSO(i,m) =e= ( AHSO(i,m) - *** ) / ( DTSO(i)-ATSO(i,m) )

The asterisks is what I am not able to input. How can I express the ‘sum’ in GAMS that ‘i’ = ‘i-1’?

Thanks.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/LyLzzb68OZcJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/gY0YkkJFQoMJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.