foo = x -> x[1]^2+x[1]*x[2]
m = Model(solver=IpoptSolver())
@variable(m,a[1:2])
JuMP.register(m, :f, 1, foo, autodiff=true)
@NLobjective(m,Min,f(a))
throws an error stating that nonlinear expressions may only contain scalar expressions.
foo2 = (x1,x2) -> x1^2+x1*x2
JuMP.register(m, :f2, 2, foo2, autodiff=true)
@NLobjective(m,Min,f2(a...))
Shouldn’t that be working with the “…”-expression? Or how to handle otherwise array inputs (in my case the size of the variable ‘a’ is changing)?