Dear Jacques,
I did the following in order to understand how GAMS handles this structure that you ask.
set t /1*10/;
parameter P(t), R(t),d;
P(t)=uniform(0,1);
R(t)=P(t)-P(t-1);
d=R(‘1’);
display d, R, P;
From the results you can see that R(1)=P(1) because there is no 0 label (e.g. P(0)).
Hope that helped,
Konstantinos Petridis
Τη Î Îμπτη, 12 ΔεκεμβÏίου 2013 1:02:05 μ.μ. UTC+2, ο χÏήστης Jacques ÎγÏαψε:
Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?
Thx,
Jacques
Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος ΠετÏίδης a écrit :
Hello Jacques,
I think you should try the following:
*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;
*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);
Hope that helps,
Konstantinos Petridis
Τη Î Îμπτη, 12 ΔεκεμβÏίου 2013 12:40:10 μ.μ. UTC+2, ο χÏήστης Jacques ÎγÏαψε:
Hello everyone !
I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :
P(t) is defined over t from 1 to 10
Then I define R(t)=P(t)-P(t-1)
What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…
Thx for your help !
–
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/groups/opt_out.