Zero Division Error

Problems with modeling
Post Reply
Merey
User
User
Posts: 1
Joined: 1 week ago

Zero Division Error

Post by Merey »

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?
Attachments
MOZSAM_test.gms
(5.72 KiB) Downloaded 42 times
MOZSAM.xlsx
(175.36 KiB) Downloaded 28 times
Fred
Posts: 373
Joined: 7 years ago

Re: Zero Division Error

Post by Fred »

Hi Merey,

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
The corresponding lines in the echo print are

Code: Select all

165  tq(c)=SAM("stax",c)/QQ0(c);
[...]
171  tim(c) = SAM("mtax",c)/SAM("ROW",c);
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

Code: Select all

tq(c)$QQ0(c)=SAM("stax",c)/QQ0(c);
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
Post Reply