My model takes a lot of time to calculate the product of variables. How can I speed up this process?
Below is the code section that is causing the issue.
Code: Select all
bdef.. benefit =e=sum((t,j),dema(t,j)*(dWind(t,j)+dSolar(t,j)+dFire(t,j))+demb(t,j)
*sum(i$ij(t,i,j),(dWind.l(t,j)+dFire.l(t,j)+dSolar.l(t,j)-xWind.l(t,i,j)-xSolar.l(t,i,j)-xFire.l(t,i,j)+xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))*(xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))))
I have located the issue to the product terms of variables:
Code: Select all
(dWind.l(t,j)+dFire.l(t,j)+dSolar.l(t,j)-xWind.l(t,i,j)-xSolar.l(t,i,j)-xFire.l(t,i,j)+xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))*(xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))
Code: Select all
power((xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j)),2)
However, if I expand the equation as
Code: Select all
(xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))*(xWind(t,i,j)+xSolar(t,i,j)+xFire(t,i,j))
Is there any way to speed up this process? I would greatly appreciate any assistance or suggestions on how to improve its efficiency. Thank you very much for your help.