Hi Miriam
Here the idea: you don’t need to define the set backwards like you do. Just use CARD(W). This will give you the number of elements in the set (the number of the last element). You can then use CARD(W) – ORD(W) + 1 to run it backwards.
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Miriam Munnich Vass
Sent: Dienstag, 13. Mai 2014 13:17
To: gamsworld@googlegroups.com
Subject: Re: Specification of a dubble SUM
Hi Renger!
Thank you very much for your suggestion!! I am very sorry for not including my code, it was a mistake from a GAMS beginner.
I have now included my suggested code for the same problem and hope that you will be kind and help me specifying how to work backwards in GAMS. I have explained my problem and included the code in the attached document.
Thanks a lot for assisting me!
Best regards,
Miriam
Den tisdagen den 13:e maj 2014 kl. 10:46:24 UTC+2 skrev Renger van Nieuwkoop:
Hi Miriam
I would be good, if you always send the complete code you tried and not only a part. But here is my guess.
First of all, you can write the exception as you did using the dollar sign twice (if you would run your code, Gams would certainly complain about the second $-sign).
Furthermore, you have W as set and then try to use this as a power (0.98**W). W is a string and not a number, so you should first convert it to a number by using for example ORD.
Here a piece of code that probably get you starting (once again, you should really post the code you tried with all the information necessary to check your code).
set T Time Periodes /T1*T10/;
set I sectors /I1*I2/;
alias(T, TAU,W);
variables F(I,TAU), DECAY(I,T);
equations eqDecay(I,T);
eqDecay(I,T)…
SUM((TAU,W)$([ORD(TAU) LT ORD(T)] AND [ORD(W) LT ORD(T)]),
(0.98**ORD(W))*F(I,TAU))=E=DECAY(I,T);
Hope this helps
Renger
\
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
In…@modelworks.ch
blog.modelworks.ch
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Miriam Munnich Vass
Sent: Montag, 12. Mai 2014 22:21
To: gams...@googlegroups.com
Subject: Specification of a dubble SUM
Hi!
I would very much appreciate some help in formulating, in GAMS, the dubble sum expressed in the equation in the attached document.
I have tried several options without success, including the following which does not work properly:
SUM((TAU,W)[ORD(TAU) LT ORD(T)] AND [ORD(W) LT ORD(T)],(0.98**W)*F(I,TAU))=E=DECAY(I,T);
Thank you very much in advance for helping me!
Best regards,
Miriam
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.