Division by zero execution error

Problems with modeling
Post Reply
shoebmoon
User
User
Posts: 2
Joined: 7 months ago

Division by zero execution error

Post by shoebmoon » 4 months ago

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 18 times

Online
Fred
Posts: 158
Joined: 3 years ago

Re: Division by zero execution error

Post by Fred » 3 months ago

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