using JuMP,CSV,DataFrames

model = Model()

@variable(model, x[1:3])

@constraint(model, c2, x[1] + 2 * x[3] >= 2)

@constraint(model, c4, 4 <= 2 * x[2] <= 5)

@variable(model,x1[h in 1:5, i in 1:1, j in 1:2, k in 1:1,p in 1:2]);

h=5

i=1

j=2

k=1

p=2

function readBook2(localpath::String)

df = CSV.read(string(localpath,“Book2.csv”),DataFrame)

df2=Array{Union{Nothing, Any}}(nothing, h,i,j,k,p);

for h in 1:5

for i in 1:1

for j in 1:2

for k in 1:1

for p in 1:2

# zz=0.05

print(“h==$h”)

df2[h,i,j,k,p]=eval.(Meta.parse.(df[!,2]))

end

end

end

end

end

zz=@NLexpression(model,sum(x1[h,i,j,k,p]*df2[h,i,j,k,p] for h in 1:5 , i in 1:1, j in 1:2, k in 1:1 ,p in 1:2 ))

return

end

LoadError: Unexpected array QuadExpr[9.206640000000007e-13 x1[5,1,2,1,2]² + 1.8904140000000001e-6 x1[5,1,2,1,2] + 196.3769] in nonlinear expression. Nonlinear expressions may contain only scalar expressions.