The Usual Disclaimers Apply

CGEモデル分析、ときどきDIY&フライトログ(しばしば比率逆転)

GAMS: Lag & Lead Operator

ラグ、リードつきのインデックスを使う際の注意。


1 set t /1*100/;
2
3 parameter a(t), b(t), c(t), d(t);
4
5
6 a(t)=ord(t);
7
8 b(t)=a(t-10);
9
10 c(t)=a(t-(5+5));
11
12 d(t)=a(t-5-5);
**** $8$408
**** 8 ')' expected
**** 408 Too many ),] or }
13
14
15 display a,b,c,d;
**** 2 ERROR(S) 0 WARNING(S)


c(t)のようにするのはOKだが、d(t)のようにするのはNG。一見ナンセンスのようだが、理由はマニュアル参照


Attention

GAMS is able to distinguish linear lag and lead operators (+,-) from arithmetic operators by context. To avoid ambiguity, GAMS does not allow to mix lag and lead operators with arithmetic operators. For example, i + 1 + 1 is not allowed, but writing i + (1 + 1) would work.