Please help: error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0) Topic is solved

Problems with modeling
Post Reply
sam jin
User
User
Posts: 2
Joined: 2 years ago

Please help: error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)

Post by sam jin »

Dear all,

I am now working with a Spatial Equilibrium Model using my own data with mcp and option path, but I have some troubles.
The system report 2 errors with the message as below:

**** ERRORS/WARNINGS IN EQUATION eqPaj2(EUd)
24 error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)
**** ERRORS/WARNINGS IN EQUATION eqPbj2(EUd)
26 error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)

The functions are
eqpaj2(EUd).. Daj2(EUd)-ALPHAaj2(EUd)*(Paj2(EUd)**BETAaj2(EUd))*(Pbj2(EUd)**GAMMAaj2(EUd)) =g= 0;
eqPbj2(EUd).. Dbj2(EUd)-ALPHAbj2(EUd)*(Paj2(EUd)**BETAbj2(EUd))*(Pbj2(EUd)**GAMMAbj2(EUd)) =g= 0;

Daj2 and Dbj2 are demand quantity of a or b product in EU market.
ALPHAaj2 and ALPHAbj2 are parameter which is positive.
Paj2 and Pbj2 are market price of a or b product in EU market.
BETAaj2, BETAbj2, GAMMAaj2, GAMMAbj2 are price elasticity of demand of a or b product.

Daj2(EUd) = 5550701000
Dbj2(EUd) = 210311
ALPHAaj2(EUd) = 7455645000
ALPHAbj2(EUd) = 1310353
Paj2(EUd) = 8.88
BETAaj2(EUd) = -0.137
BETAbj2(EUd) = 0.645
Pbj2(EUd) = 63.18
GAMMAaj2(EUd) = 0.000997
GAMMAbj2(EUd) = -0.781

It seems that errors occurred because BETAaj2(EUd) and GAMMAbj2(EUd) are negative.
However, other countries share the same functions above also have the negative exponents but report no error.

I searched this error in gams forum and know that when X**C, c cannot be negative.
Also, power function does not work because the negative price elasticity are not integer.
I also tried vcpower and cvpower but neither worked.

Can anyone tell me why errors only occurred in EUd functions
and how to solve the problem when exponents are negative but not integer?
Any information or insight that anyone may offer would be greatly appreciated.
Thank you!!
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Please help: error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)

Post by abhosekar »

Hi, The error says you cannot have x=0 and c < 0. You correctly point out that c < 0 but the real problem here is that x "can be" 0 i.e., 0 is in the domain of x. Are you defining paj2 and pbj2 as positive variables? If yes, then 0 is in the domain and since 0**negative power is not defined you get this error.

You can set paj2.lo(EUd) = small number and pbj2.lo(EUd)=small number; (to remove 0 from the domain).
paj2.l(EUd) = 1;pbj2.l = 1; (provide initial guess so that the solver does not start from the small lower bound resulting in numerical issues).

Hope this helps.

- Atharv
sam jin
User
User
Posts: 2
Joined: 2 years ago

Re: Please help: error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)

Post by sam jin »

Dear Atharv,

Thank you very much for your kindly help.

As you mentioned in the rely, I only set paj2 and pbj2 as positive variables.
After I set the lower bound 0.01 and actual value in 2019 as initial value to paj2 and pbj2, errors were fixed.

Thanks again for your help.
Sam



abhosekar wrote: 2 years ago Hi, The error says you cannot have x=0 and c < 0. You correctly point out that c < 0 but the real problem here is that x "can be" 0 i.e., 0 is in the domain of x. Are you defining paj2 and pbj2 as positive variables? If yes, then 0 is in the domain and since 0**negative power is not defined you get this error.

You can set paj2.lo(EUd) = small number and pbj2.lo(EUd)=small number; (to remove 0 from the domain).
paj2.l(EUd) = 1;pbj2.l = 1; (provide initial guess so that the solver does not start from the small lower bound resulting in numerical issues).

Hope this helps.

- Atharv
JohnReidubsP
User
User
Posts: 1
Joined: 2 years ago

Re: Please help: error(s): vcPower: FUNC DOMAIN: x**c, x=0, c<0 (RETURNED 0)

Post by JohnReidubsP »

Hello, I had the same problem, really thank you for help
Post Reply