Hello,
I have the following code in GAMS, where I want to subtract X from Y and reassign the result back to X. However, I’m not sure what the issue is!
Equation es1(t), es2(t), es3(t), es4(t), es5(t);
Parameters X(*, b);
Variable Y(t, z);
es1(t).. X(t, '6') =e= Y(t, 'z1') - X(t, '6');
es2(t).. X(t, '18') =e= Y(t, 'z2') - X(t, '18');
es3(t).. X(t, '21') =e= Y(t, 'z3') - X(t, '21');
es4(t).. X(t, '24') =e= Y(t, 'z4') - X(t, '24');
es5(t).. X(t, '30') =e= Y(t, 'z5') - X(t, '30');
Here:
- X is a parameter.
- Y is a variable.
- Both have numeric values.
When I use the command display Y.l;
, I encounter the following error:
Error 141: Symbol declared but no values have been assigned. Check for missing data definition, assignment, data loading or implicit assignment via a solve statement. A wild shot: You may have spurious commas in the explanatory text of a declaration. Check symbol reference list.
However, if I run the display Y.l;
command before these equations, it works fine and displays the values without any problem.
I would greatly appreciate it if you could guide me on how to fix this issue.
Thank you!