mfseker
mfseker

Reputation: 1

How can i use $ in x(i,j) - GAMS

i tried this & doesn't work and given errors something like that.

EQUATIONS ST3(i$(ord(i) LE (5) and ord(i) GE (1)),k$(ord(k) LE (19) and ord(k) GE (1)));

** $10,185 $195,96

ST3(i$(ord(i) LE (5) and ord(i) GE (1)),k$(ord(k) LE (19) and ord(k) GE (1))) ..

** $148,8 $36 $409

IN(i,k) + sum(j, X(j,k+1)*p(i,j)) + W(i,k+1) - W(i,k) - sum(j, X(j,k)*p(i+1,j)) - IN(i+1,k) =E=0;

8 ')' expected

10 ',' expected

36 '=' or '..' or ':=' or '$=' operator expected rest of statement ignored

96 Blank needed between identifier and text (-or- illegal character in identifier) (-or- check for missing ';' on previous line)

148 Dimension different - The symbol is referenced with more/less indices as declared

185 Set identifier or '*' expected

195 Symbol redefined with a different type

409 Unrecognizable item - skip to find a new statement looking for a ';' or a key word to get started again

how can i fix these code part?

Upvotes: 0

Views: 2349

Answers (2)

user1308309
user1308309

Reputation: 1

VRp,k = VRZEROp + RPp, k × δ p, k=1 VRp,k variable VRZEROp parameter RPp, k parameter

How this equation is identified on Gams for k=1

Upvotes: 0

foglerit
foglerit

Reputation: 8279

GAMS will not accept $ expressions in equation declarations (or any declarations). Also, in equation definitions, the $ expression must be specified after the domain.

This should work:

EQUATIONS ST3(i,k);
ST3(i,k)$(ord(i) LE 5 and ord(i) GE 1 and ord(k) LE 19 and ord(k) GE 1) ..
IN(i,k) + sum(j, X(j,k+1)*p(i,j)) + W(i,k+1) - W(i,k) - sum(j, X(j,k)*p(i+1,j)) - IN(i+1,k) =E=0;

Upvotes: 0

Related Questions