A "division by zero" in a line where no calculation happens

Being a relatively new in GAMS programming, I have a dynamic single country CGE model implemented in GAMS. I am trying to change the region of interest for the model. After changing the model’s input data, I firstly try to run the static simulation. By doing so, while the sets are read smoothly, a division by zero occurs in a line where no calculation happens (e.g. line 2967 the first error). So, I am unable to debugg the model. Atached photo shows the errors that arise. For reproducing the case, from the attached files (files (2).zip), the “stat_shk.gms” needs to be run. The other folder’s files are just needed because the “stat_shk.gms” opens them. Only the working directory path and the paths of the files that are opened need to be changed (I have marked these three regions with “to be changed”).

Could anyone help me?

Thank you in advance.
files (2).zip (34 KB)
Error log.PNG

Hi,

Note that the line numbers refer to the echo print in the lst file.
Unfortunately, some if the include files are missing in the zip archive, so it is not possible to reproduce the problem.

Best,
Fred

Hi
If you want help, you should provide your model in such a way that it runs without any interference from the person who wants to help you.
In your case, you should be sure that all files used are included (which is not the case) and the model produces lots of errors because of paths to subdirectories that do not exist.
Test your files before you send them.
Cheers
Renger

Thank you so much for your replies and apologies for any missing files required for reproducing the problem (stat_shk.gms).

I hope that now by using the attached files, the reproduction (stat_shk.gms) is possible.
The only requirement is the file’s working directory to be changed.

Thank you in advance.
files (2).zip (102 KB)

Hi,

As I wrote in my previous post, the line numbers refer to the echo print in the lst file.
Looking up the lines and checking the data, there is obviously a division by zero.

Best,
Fred

thank you so much for your reply.

Hi
A good way of testing if you are missing zero values is the following:

yh.l(h,t) = yh.l(h,t) + EPS;
display yh.l;

GAMS doesn’t display zeros, so you would easily miss parameters that are zero. Adding EPS (the special value EPS is numerically equal to zero, so when used in the context of numerical comparisons, it behaves as zero) displays all values.
In your case:

----   2967 VARIABLE yh.L  Total household income

            base       check       shock

PRIV         EPS         EPS         EPS

Cheers
Renger

Thank you Mr. Renger for your answer.