# using "max" in nonlinear constraints

**URL:** <https://discourse.julialang.org/t/using-max-in-nonlinear-constraints/21606>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [March 7, 2019, 9:45pm UTC](https://discourse.julialang.org/t/using-max-in-nonlinear-constraints/21606 "2019-03-07T21:45:24Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![zhangxz1123](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@zhangxz1123](https://discourse.julialang.org/u/zhangxz1123)\
**Post date:** [March 8, 2019, 6:26pm UTC](https://discourse.julialang.org/t/using-max-in-nonlinear-constraints/21606/10 "2019-03-08T18:26:50Z")

</div>

@odow, a follow-up question on splatting syntax. It seems that currently the splatting only works on the variable itself. However, in my problem, the variable is saved as a matrix, but the max is only taken over one column of the variable, e.g.

```julia
using JuMP, Ipopt
m = Model(with_optimizer(Ipopt.Optimizer))
M=5
N=2
@variable(m, x[1:M,1:N])
f(y...) = max(y...)
JuMP.register(m, :f, N, f, autodiff=true)
@NLobjective(m, Min, f(x[1,:]...)
optimize!(m)

```

But this is not allowed. I tried to make `f` act on `x` itself, but didn’t get it to work. Is there any elegant solution?

---

_[View the full topic](https://discourse.julialang.org/t/using-max-in-nonlinear-constraints/21606)._
