Dear All,
I run and got the error:
rPower: FUNC DOMAIN: x**y, x=0,y<0
Files attached.
I appreciate it if someone can help.
Thanks and regards,
Douglas
 HSRTWN20201115.gms(272) 4 Mb
*** Error at line 272: rPower: FUNC DOMAIN: x**y, x=0,y<0
 HSRTWN20201115.gms(276) 4 Mb 1 Error
*** Error at line 276: rPower: FUNC DOMAIN: x**y, x=0,y<0
 HSRTWN20201115.gms(312) 4 Mb 2 Errors
*** Status: Execution error(s)
 Job HSRTWN20201115.gms Stop 11/23/20 16:10:04 elapsed 0:00:03.331
Exit code = 3
rPower: FUNC DOMAIN: x**y, x=0,y<0 Topic is solved

 User
 Posts: 21
 Joined: 2 months ago
Re: rPower: FUNC DOMAIN: x**y, x=0,y<0
I delete the more remark "*" (left only one).
But, I have the same errors.
But, I have the same errors.
Re: rPower: FUNC DOMAIN: x**y, x=0,y<0
Hi
This kind of error is mostly due to having no starting values for the variables. Gams assumes in that case 0, causing an error in the power function.
As your model is a CGE model, you should start with an equilibrium based on your SAM data. This means if you plug in all the values of your SAM and initialize your prices and production levels to their benchmark levels (most of the time equal to 1) and setting the iteration limit to zero, your model should find a solution. Just search in the forum as I have suggested this in more detail in other posts. (In my workshop, this is my "3 AM message": If I would wake you up in the night at 3 AM and ask you what is the most important thing you should do when working with CGE models, you should answer: Set the iteration limit to 0 and initialize the model properly to check the benchmark!
Eventually, it might be that during the solve the variables become negative. If you are sure that the variables are positive (like prices and quantities) you can define them as positive variables.
Cheers
Renger
This kind of error is mostly due to having no starting values for the variables. Gams assumes in that case 0, causing an error in the power function.
As your model is a CGE model, you should start with an equilibrium based on your SAM data. This means if you plug in all the values of your SAM and initialize your prices and production levels to their benchmark levels (most of the time equal to 1) and setting the iteration limit to zero, your model should find a solution. Just search in the forum as I have suggested this in more detail in other posts. (In my workshop, this is my "3 AM message": If I would wake you up in the night at 3 AM and ask you what is the most important thing you should do when working with CGE models, you should answer: Set the iteration limit to 0 and initialize the model properly to check the benchmark!
Eventually, it might be that during the solve the variables become negative. If you are sure that the variables are positive (like prices and quantities) you can define them as positive variables.
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

 User
 Posts: 21
 Joined: 2 months ago
Re: rPower: FUNC DOMAIN: x**y, x=0,y<0
Dear Renger,
Thank you for your reply. I think the error is because the "QDA(a)" or "QE0(a)" is zero.
The code is:
deltaCET(a)=PDA0(a)*QDA0(a)**(1rhoCET(a))/(PDA0(a)*QDA0(a)**(1rhoCET(a))+PE0(a)*QE0(a)**(1rhoCET(a)));
If I want to skip the code if "QDA(a)" or "QE0(a)" is zero, how can I do? Can I amend the code as below?
deltaCET(a)$(QDA(a),QE0(a))=PDA0(a)*QDA0(a)**(1rhoCET(a))/(PDA0(a)*QDA0(a)**(1rhoCET(a))+PE0(a)*QE0(a)**(1rhoCET(a)));
Thank you.
Regards,
Douglas
Thank you for your reply. I think the error is because the "QDA(a)" or "QE0(a)" is zero.
The code is:
deltaCET(a)=PDA0(a)*QDA0(a)**(1rhoCET(a))/(PDA0(a)*QDA0(a)**(1rhoCET(a))+PE0(a)*QE0(a)**(1rhoCET(a)));
If I want to skip the code if "QDA(a)" or "QE0(a)" is zero, how can I do? Can I amend the code as below?
deltaCET(a)$(QDA(a),QE0(a))=PDA0(a)*QDA0(a)**(1rhoCET(a))/(PDA0(a)*QDA0(a)**(1rhoCET(a))+PE0(a)*QE0(a)**(1rhoCET(a)));
Thank you.
Regards,
Douglas
Re: rPower: FUNC DOMAIN: x**y, x=0,y<0
Hi
You can add the dollar constraint like this:
Cheers
Renger
You can add the dollar constraint like this:
Code: Select all
deltaCET(a)$(PDA0(a) > 0 and QE(0) > 0) =PDA0(a)*QDA0(a)**(1rhoCET(a))/(PDA0(a)*QDA0(a)**(1rhoCET(a))+PE0(a)*QE0(a)**(1rhoCET(a)));
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

 User
 Posts: 21
 Joined: 2 months ago
Re: rPower: FUNC DOMAIN: x**y, x=0,y<0
Dear Renger
Thank you for the help.
Regards,
Douglas
Thank you for the help.
Regards,
Douglas