how to use lag operation including a variable

hello,everyone
i have a problem about using lag operation including a variable,the
piece of the model as follow:

set j;
parameter e_t(j);

integer variable s(i,j);

equation ff(i,j) the cost per appliance;

ff(i,j)… f(i,j) =e= e_t(j+s(i,j)) *p_n(i)*x(i,j)*p1(i,j)

the lag operation used at e_t(j+s(i,j))
when i run the program,there will be a error 62:endogenous lag
operations are illegal.
could anyone tell me how to solve this problem,thanks a lot.


Your sincerely
You Yaxiong

\

ff(i,j)… f(i,j) =e= e_t(j+s(i,j)) *p_n(i)*x(i,j)*p1(i,j)

the lag operation used at e_t(j+s(i,j))
when i run the program,there will be a error 62:endogenous lag
operations are illegal.

‘j+s(i,j)’ is illegal and cannot be used as a index.
s(i,j) is a value, while j is an index here ( in fact it is a string).
in e_t(j+s(i,j)) you are using ‘+’ operation for index and values,
this is not illegal in GAMS.

for example:

Set j /1,2,three/;
Parameter S(j)
/
1 11,
2 22,
three 33
/;

then S(‘1’) have value 11 and S(‘three’) have value 33

the order of a index, which is an positive integer, can be obtained using function ord().
for example:

ff(i,j)… f(i,j) =e= e_t(i,j) + ord(j);

HTH,

Yan

\

could you please tell me exactly what is the solution of the above issue if i need to refer to index plus variable

بتاريخ الخميس، 24 مايو، 2012 UTC+3 5:00:01 ص، كتب Ryan Ren:

ff(i,j)… f(i,j) =e= e_t(j+s(i,j)) *p_n(i)*x(i,j)*p1(i,j)

the lag operation used at e_t(j+s(i,j))
when i run the program,there will be a error 62:endogenous lag
operations are illegal.

‘j+s(i,j)’ is illegal and cannot be used as a index.
s(i,j) is a value, while j is an index here ( in fact it is a string).
in e_t(j+s(i,j)) you are using ‘+’ operation for index and values,
this is not illegal in GAMS.

for example:

Set j /1,2,three/;
Parameter S(j)
/
1 11,
2 22,
three 33
/;

then S(‘1’) have value 11 and S(‘three’) have value 33

the order of a index, which is an positive integer, can be obtained using function ord().
for example:

ff(i,j)… f(i,j) =e= e_t(i,j) + ord(j);

HTH,

Yan


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.