JuMP vector input in Nonlinear expressions


foo = x -> x[1]^2+x[1]*x[2]
m = Model(solver=IpoptSolver())
JuMP.register(m, :f, 1, foo, autodiff=true)

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)

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)?


I am aware that


is working.