# Multiple amount of summations in JuMP

**URL:** <https://discourse.julialang.org/t/multiple-amount-of-summations-in-jump/27083>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [August 1, 2019, 5:11pm UTC](https://discourse.julialang.org/t/multiple-amount-of-summations-in-jump/27083 "2019-08-01T17:11:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newjuliauser](https://avatars.discourse-cdn.com/v4/letter/n/41988e/32.png) [@newjuliauser](https://discourse.julialang.org/u/newjuliauser)\
**Post date:** [August 1, 2019, 5:11pm UTC](https://discourse.julialang.org/t/multiple-amount-of-summations-in-jump/27083/1 "2019-08-01T17:11:43Z")

</div>

Hello, I’m wondering If it is possible to pass a multi summation expression into setNLobjective. Currently I have a for loop to compute summation, but, I was wondering if it is possible to optimize with JuMP on this front.

```julia
JuMP.setNLobjective(m, :Min, sum(sum(sum(sum(expres[i,j,k,t] for i=1:W) for j=1:X) for k=1:Y) for l=1:Z))

```

sorry, I’m really new to this stuff ☹ any comments will be helpful!

edit: Using IpopT solver, if that is important

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 3, 2019, 8:39am UTC](https://discourse.julialang.org/t/multiple-amount-of-summations-in-jump/27083/2 "2019-08-03T08:39:53Z")

</div>

Try using the `@NLobjective` macro:

```nohighlight
@NLobjective(model, Min, sum(sum(x[i, j] for j in 1:J) for i in 1:N))

```

You should also read [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757) and provide a minimal example of what you are trying to achieve.
