Division by zero execution error Topic is solved

Problems with modeling
Post Reply
shoebmoon
User
User
Posts: 4
Joined: 5 years ago

Division by zero execution error

Post by shoebmoon »

Hi,

Need help in correcting the division by zero execution time error in my code attached
The errors occur in equation 43-47. I have declared the variables in denominator as positive variable and also bounded in constraints.
:(

Code: Select all

e43.. CE1 =e= Alpha*((Q12/(U12*(0.5*Theta11*Theta21*(Theta11+Theta21))**0.33))**Beta);
Thanks
HEN_3_Ali.gms
(4.89 KiB) Downloaded 165 times
Fred
Posts: 372
Joined: 7 years ago

Re: Division by zero execution error

Post by Fred »

Hi,

you should set actual variable bounds like

Code: Select all

Theta11.lo = 10;
Theta21.lo = 10;
Theta12.lo = 10;
Theta22.lo = 10;
Theta13.lo = 10;
Theta23.lo = 10;
Theta14.lo = 10;
Theta24.lo = 10;
Theta15.lo = 10;
Theta25.lo = 10;
instead of trying to enforce bounds via constraints like

Code: Select all

e14.. Theta11=g=10;
e15.. Theta21=g=10;
e16.. Theta12=g=10;
e17.. Theta22=g=10;
[...]
By default, variable levels are at the lower bound. Hence, if you do not provide proper lower bounds, you run into the division by zero error right at the start point.

I hope this helps!

Fred
Post Reply