# JuMP constraint: how to use more than one filter elements in the sets

**URL:** https://discourse.julialang.org/t/jump-constraint-how-to-use-more-than-one-filter-elements-in-the-sets/73928
**Category:** Optimization (Mathematical)
**Created:** [January 2, 2022, 2:21pm UTC](https://discourse.julialang.org/t/jump-constraint-how-to-use-more-than-one-filter-elements-in-the-sets/73928 "2022-01-02T14:21:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Luiz\_Monteiro](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)
#### Post date: [January 2, 2022, 2:21pm UTC](https://discourse.julialang.org/t/jump-constraint-how-to-use-more-than-one-filter-elements-in-the-sets/73928/1 "2022-01-02T14:21:35Z")

</div>

Hi,  
In JuMP, I need to implement a constraint that uses more than one filter elements in the sets.  
It seems that JuMP accepts only one filter. The error message is:“There can be at most one filtering condition, which is separated from the indices by a single `;`.”

The constraint expression I am trying to implement is:

# If j\<=1 and Mdummy[i,j]=1 than T[j] \<= T[i]:

# Mdummy is a parameter

@constraint(model1, con[i in Vst\_total, j in Vst\_total; Mdummy[i,j]==1, j\<=i], T[j]\<= T[i])

Does anybody knows how to solve it?  
Thanks in advanced!

---

<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: [January 2, 2022, 8:48pm UTC](https://discourse.julialang.org/t/jump-constraint-how-to-use-more-than-one-filter-elements-in-the-sets/73928/2 "2022-01-02T20:48:59Z")

</div>

Use a boolean operator:

```nohighlight
@constraint(model1, con[i in Vst_total, j in Vst_total; Mdummy[i,j]==1 && j<=i], T[j]<= T[I])
# ^^

```

---

<div class="post-metadata">

### Author: ![Luiz\_Monteiro](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)
#### Post date: [January 5, 2022, 12:53am UTC](https://discourse.julialang.org/t/jump-constraint-how-to-use-more-than-one-filter-elements-in-the-sets/73928/3 "2022-01-05T00:53:39Z")

</div>

@odow Thank you for your reply. It works well.
