I am wondering how to eliminate the problem of division by 0 in the objective function.

I consider that the denominator is not 0 but it shows the problem.

Also, is it possible for changing this non-linear programming to linear programming?

I am appreciated for your reply!

set

t period /1*2/

i parts /i1,i2/;

variable

total

meanofX

avgq

DCvariable

BWE

sumofall

sumofallq

DD(t)

;

free variable z;

parameter

it(t)

totalt

u(t)

X(t)

X(t) /1 70,2 100/;

totalt=card(t);

it(t)=ord(t)-1;

u(t)=uniform(0,1);

SCALAR

gamma/0.4/;

equation

bweX1

bweX2

bweX3

bweX4

varq1

varq2

varq3

obj;

bweX1..sumofall=E=sum(t,X(t));

bweX2..total=e=totalt;

bweX3..meanofX=e=(sumofall/totalt);

bweX4..BWE=e=sum(t,sqr(X(t)-meanofX))/totalt;

varq1..sumofallq=e=sum(t,DD(t));

varq2..avgq=e=(sumofallq/totalt);

varq3..DCvariable=e=sum(t,sqr(DD(t)-avgq))/totalt;

**obj..z=e=DCvariable/BWE;**<<it shows the problem here.

model LP/

all/;

Solve LP using NLP maximizing BWE;

Display BWE.L,meanofX.L,total.L;