Hi, I am using Juniper to solve MNILP and with array of nonlinear expression i am getting invalid model error. is there a way to generate nonlinear expression names in a loop like
@variable(model,x)
zz=0.0
for i in 1:5
for j in 1:5
global zz=zz+1
println(zz)
xmm_$zz=@NLexpression(model,x+x*x+zz)
end
end
println(model)
Thanks for the reply. I am trying to build a NL exp.
for t in 1:N
WBMOM[t]= @NLexpression(mod,Tnkcn[t,1] + Tnk[p,t]*Tnkcn[t,2]*zz*Tnk[p,t]
+ Tnk[p,t]*Tnkcn[t,3]*(zz*Tnk[p,t])^2 +Tnk[p,t]*Tnkcn[t,4]*(zz*Tnk[p,t])^3 +
Tnk[p,t]*Tnkcn[t,5]*(zz*Tnk[p,t])^4
+Tnk[p,t]*Tnkcn[t,6]*(zz*Tnk[p,t])^5 +Tnk[p,t]*Tnkcn[t,7]*(zz*Tnk[p,t])^6 )
end
This resolves this issue. But model is still invalid and trying to pinpoint the expression /constraints.