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.
A "division by zero" in a line where no calculation happens Topic is solved
Re: A "division by zero" in a line where no calculation happens
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
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
Re: A "division by zero" in a line where no calculation happens
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
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
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: A "division by zero" in a line where no calculation happens
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.
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.
Re: A "division by zero" in a line where no calculation happens
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
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
Re: A "division by zero" in a line where no calculation happens
thank you so much for your reply.
Re: A "division by zero" in a line where no calculation happens
Hi
A good way of testing if you are missing zero values is the following:
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:
Cheers
Renger
A good way of testing if you are missing zero values is the following:
Code: Select all
yh.l(h,t) = yh.l(h,t) + EPS;
display yh.l;
In your case:
Code: Select all
---- 2967 VARIABLE yh.L Total household income
base check shock
PRIV EPS EPS EPS
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: A "division by zero" in a line where no calculation happens
Thank you Mr. Renger for your answer.