Hi!
I was trying to create a model for Mozambique. But the program gets zero division error every time. I see gaps in my data set, but I don't know how I can fill them. Any ideas?
Zero Division Error
Zero Division Error
- Attachments
-
- MOZSAM_test.gms
- (5.72 KiB) Downloaded 120 times
-
- MOZSAM.xlsx
- (175.36 KiB) Downloaded 91 times
Re: Zero Division Error
Hi Merey,
Running your code, I get
The corresponding lines in the echo print are
If QQ0(c) is zero for certain c, you get a division by zero error. The question is, what should tq(c) be for those elements in c? You could for example just skip those c by adding a simple dollar condition
You could use the same "trick" in line 171 as well. The question is, whether this gives you the desired results? You are the only person that can answer this question.
I hope this helps!
Fred
Running your code, I get
Code: Select all
--- MOZSAM_test.gms(165) 4 Mb[FIL:"C:\Users\ffian\Documents\support\MOZSAM_test.gms",165,0]
*** Error at line 165: division by zero (0)[LST:522]
--- MOZSAM_test.gms(171) 4 Mb 1 Error[FIL:"C:\Users\ffian\Documents\support\MOZSAM_test.gms",171,0]
*** Error at line 171: division by zero (0)[LST:523]
--- MOZSAM_test.gms(899) 6 Mb 2 Errors
Code: Select all
165 tq(c)=SAM("stax",c)/QQ0(c);
[...]
171 tim(c) = SAM("mtax",c)/SAM("ROW",c);
Code: Select all
tq(c)$QQ0(c)=SAM("stax",c)/QQ0(c);
I hope this helps!
Fred