There's no syntax for this at the moment, it's a known issue. The problem 
is that JuMP's internal representation of nonlinear expressions doesn't 
allow vectors or matrices.
For the moment we're targeting the use cases where the function is low 
dimensional. For box-constrained nonlinear optimization you can use 
Optim.jl.

(By the way, better to post questions like these to julia-opt 
<https://groups.google.com/forum/#!forum/julia-opt>.)

On Monday, February 29, 2016 at 6:50:50 PM UTC-5, jock....@gmail.com wrote:
>
> Hi there,
>
> I have a nonlinear varargs function f(x...) that I'd like to maximize. 
> That is, the function is defined as follows:
>
> function f(x...)
>     # do stuff here
>     result
> end
>
> With a small number of arguments, for example 2, I can write the following 
> and get the correct result:
>
>     registerNLFunction(:f, 2, f, autodiff=true)
>     m = Model()
>     @defVar(m, x[1:2] >= 0.0)
>     @setNLObjective(m, Max, f(x[1], x[2]))
>
> With a large number of arguments, say 100, I'd prefer not to manually 
> write f(x[1], ..., x[100]) in the @setNLObjective macro.
> I have tried the following to no avail:
>     @setNLObjective(m, Max, f(x...))
>     @setNLObjective(m, Max, f(tuple(x...)))
>
> Is there a way to get this going for 100 variables without having to 
> manually write f(x[1], ..., x[100])?
>
> Cheers,
> Jock
>
> p.s. Thanks for the great work on 0.12.0 - it's awesome.
>
>

Reply via email to