Dear Members,
I hope you are well and keeping safe.
This is to request for your assistance in resolving this execution error. I am a basic GAMS user and have encountered the error: “Division by zero”. I have read the GAMS guide and some posts on the forum but I have not yet found the solution. The error is located at line 847-Division by zero.
847 KDO(k,j) = RKDO(k,j)/RO(k,j);
Here is the genesis of that computation in the model code:
alpha = SUM[(k,j),RKDO(k,j)*{(n1+delta(k,j))
/(delta(k,j)+IRO)}
/(ITO-SUM[i,PCO(i)*VSTKO(i)])];
RO(k,j) = alpha*UO(k,j);
KDO(k,j) = RKDO(k,j)/RO(k,j);
I am attaching the zipped model file in case you need to run through it, in order to assist me. In the project file: Ug-CGE.gpr, I am running the model: PEP_1-t-b_v2_1.gms, which calls the files: SAM-V2_0.xlxs and VAL_PAR.
Thanking you for your kind assistance in advance.
Best wishes,
Judith
Division by Zero error
Re: Division by Zero error
Hi Judith
If GAMS tells you that there is a division by zero, you can bet on it that there is one, so you should display the divisor. One problem is that zero values are not shown in the output. You can check this by adding EPS to the parameter (after checking I should remove it).
If you do this, you will see that AGA21 and AGA22 have zero values. Check if that makes sense, and if yes adjust your code accordingly.
Cheers
Renger
If GAMS tells you that there is a division by zero, you can bet on it that there is one, so you should display the divisor. One problem is that zero values are not shown in the output. You can check this by adding EPS to the parameter (after checking I should remove it).
Code: Select all
RO(k,j) = RO(k,j) + EPS;
display RO;
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: Division by Zero error
Hi Renger,
Thank you very much for your guidance.
Best wishes,
Judith
Thank you very much for your guidance.
Best wishes,
Judith