Dear (sirs),
I encounter an Execution error (Execution Error : Division by zero) on line 188 after running my model in GAMS.
Will like to know the root cause. and possibly rectification.
Find my GAMS code in the attached file.
Regards,
Moyo.
Execution Error : Division by zero

 User
 Posts: 12
 Joined: 11 months ago
Execution Error : Division by zero
 Attachments

 STO.gms
 (9.61 KiB) Downloaded 22 times
Re: Execution Error : Division by zero
Hi
The only equation in the model used with a division is:
You could rewrite the equation by adding a $constraint, but I don't know if this is what you want:
Cheers
Renger
The only equation in the model used with a division is:
so, it looks like the difference between maxobj(om1) and minobj(om1) gets zero for a certain or all om1.augm_obj.. sum(o1,dir(o1)*b(o1)) + 1e3*sum(om1,sl(om1)/(maxobj(om1)  minobj(om1))) =e= a_objval;
You could rewrite the equation by adding a $constraint, but I don't know if this is what you want:
Hope this helpsaugm_obj.. sum(o1,dir(o1)*b(o1)) + 1e3*sum(om1$(maxobj(om1)  minobj(om1)),sl(om1)/(maxobj(om1)  minobj(om1))) =e= a_objval;
Cheers
Renger
____________________________________
Enjoy modeling even more: The lazy economist
Enjoy modeling even more: The lazy economist
Re: Execution Error : Division by zero
GAMS is pretty precise giving you pointers to your problem. In the listing file you find:
line 188 reads
Fortunately, there is only one division by '(maxobj(om1)  minobj(om1))'. So one of the om1 seem to have maxobj=minobj when generating the model in question (mod_epsmethod). I displayed om1, minobj, and maxobj before the repeat loop solving model mod_epsmethod and voila:
You can use the $ to avoid executing the division (e.g. sum(om1$(abs(maxobj(om1)  minobj(om1))>1e6),sl(om1)/(maxobj(om1)  minobj(om1)))), but the logical error that resulted in the division by 0 might be somewhere else.
Hope this helps,
Michael
Code: Select all
**** Exec Error at line 188: division by zero (0)
Code: Select all
188 augm_obj.. sum(o1,dir(o1)*b(o1)) + 1e3*sum(om1,sl(om1)/(maxobj(om1)  minobj(om1))) =e= a_objval;
Code: Select all
 260 SET om1 all but the first elements of k
te, tj
 260 PARAMETER maxobj maximum value from the payoff table
( ALL 0.000 )
 260 PARAMETER minobj minimum value from the payoff table
( ALL 0.000 )
Hope this helps,
Michael

 User
 Posts: 12
 Joined: 11 months ago
Re: Execution Error : Division by zero
Tnx alot bussieck and Renger. i appreciate you all.
Regards,
Moyo
Regards,
Moyo