Error 150: Symbolic Equations Redefined..Cannot define equations. Help!
Posted: Thu Feb 22, 2018 11:51 pm
Hi all,
I am really struggling with the Error 150 which pops up when I run my simple script. I am a beginner with GAMS. I am using the elements of a set (within quotes) to define the individual equations, but it is giving me the error. I think it has got something to do with domain violation, but I can't figure out a way to write it. Every single one of the equations are different, so I don't know of a way to define them other than defining them individually. Here I am showing only 6 equations, but I have over 35 in my actual script. I will really appreciate if you can help me out here.
Thank you,
Anby
Script
Sets
ii actual masses /m26, m27, m28, m29, m30, m31/
j contributions / d1, d2, d3, d4/;
Variables
d(j), mz_sim(ii);
Equations
mz_sim_eqn(ii);
mz_sim_eqn('m26') .. mz_sim('m26') =e= d('d1')*x1;
mz_sim_eqn('m27') .. mz_sim('m27') =e= d('d1')*x2 + d('d2')*x1;
mz_sim_eqn('m28') .. mz_sim('m28') =e= d('d1')*x3 + d('d2')*x2 + d('d3')*x1;
mz_sim_eqn('m29') .. mz_sim('m29') =e= d('d2')*x3 + d('d3')*x2 + d('d4')*x1;
mz_sim_eqn('m30') .. mz_sim('m30') =e= d('d3')*x3 + d('d4')*x2 ;
mz_sim_eqn('m31') .. mz_sim('m31') =e= d('d4')*x3 ;
Here is the output from the .lst file.
394 mz_sim_eqn('m26') .. mz_sim('m26') =e= d('d1')*x1;
395 mz_sim_eqn('m27') .. mz_sim('m27') =e= d('d1')*x2 + d('d2')*x1;
**** $150
**** LINE 137 INPUT GAMS_dir\globalopt_v5.gms
396 mz_sim_eqn('m28') .. mz_sim('m28') =e= d('d1')*x3 + d('d2')*x2 + d('d3')*x1;
**** $150
**** LINE 138 INPUT GAMS_dir\globalopt_v5.gms
397 mz_sim_eqn('m29') .. mz_sim('m29') =e= d('d2')*x3 + d('d3')*x2 + d('d4')*x1;
**** $150
**** LINE 139 INPUT GAMS_dir\globalopt_v5.gms
398 mz_sim_eqn('m30') .. mz_sim('m30') =e= d('d3')*x3 + d('d4')*x2 ;
**** $150
**** LINE 140 INPUT GAMS_dir\globalopt_v5.gms
399 mz_sim_eqn('m31') .. mz_sim('m31') =e= d('d4')*x3 ;
**** $150
**** LINE 141 INPUT GAMS_dir\globalopt_v5.gms
I am really struggling with the Error 150 which pops up when I run my simple script. I am a beginner with GAMS. I am using the elements of a set (within quotes) to define the individual equations, but it is giving me the error. I think it has got something to do with domain violation, but I can't figure out a way to write it. Every single one of the equations are different, so I don't know of a way to define them other than defining them individually. Here I am showing only 6 equations, but I have over 35 in my actual script. I will really appreciate if you can help me out here.
Thank you,
Anby
Script
Sets
ii actual masses /m26, m27, m28, m29, m30, m31/
j contributions / d1, d2, d3, d4/;
Variables
d(j), mz_sim(ii);
Equations
mz_sim_eqn(ii);
mz_sim_eqn('m26') .. mz_sim('m26') =e= d('d1')*x1;
mz_sim_eqn('m27') .. mz_sim('m27') =e= d('d1')*x2 + d('d2')*x1;
mz_sim_eqn('m28') .. mz_sim('m28') =e= d('d1')*x3 + d('d2')*x2 + d('d3')*x1;
mz_sim_eqn('m29') .. mz_sim('m29') =e= d('d2')*x3 + d('d3')*x2 + d('d4')*x1;
mz_sim_eqn('m30') .. mz_sim('m30') =e= d('d3')*x3 + d('d4')*x2 ;
mz_sim_eqn('m31') .. mz_sim('m31') =e= d('d4')*x3 ;
Here is the output from the .lst file.
394 mz_sim_eqn('m26') .. mz_sim('m26') =e= d('d1')*x1;
395 mz_sim_eqn('m27') .. mz_sim('m27') =e= d('d1')*x2 + d('d2')*x1;
**** $150
**** LINE 137 INPUT GAMS_dir\globalopt_v5.gms
396 mz_sim_eqn('m28') .. mz_sim('m28') =e= d('d1')*x3 + d('d2')*x2 + d('d3')*x1;
**** $150
**** LINE 138 INPUT GAMS_dir\globalopt_v5.gms
397 mz_sim_eqn('m29') .. mz_sim('m29') =e= d('d2')*x3 + d('d3')*x2 + d('d4')*x1;
**** $150
**** LINE 139 INPUT GAMS_dir\globalopt_v5.gms
398 mz_sim_eqn('m30') .. mz_sim('m30') =e= d('d3')*x3 + d('d4')*x2 ;
**** $150
**** LINE 140 INPUT GAMS_dir\globalopt_v5.gms
399 mz_sim_eqn('m31') .. mz_sim('m31') =e= d('d4')*x3 ;
**** $150
**** LINE 141 INPUT GAMS_dir\globalopt_v5.gms