# JuMP constraint with limited dimension of an index

**URL:** <https://discourse.julialang.org/t/jump-constraint-with-limited-dimension-of-an-index/89100>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [October 22, 2022, 8:01am UTC](https://discourse.julialang.org/t/jump-constraint-with-limited-dimension-of-an-index/89100 "2022-10-22T08:01:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeryKay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/merykay/32/43753_2.png) [@MeryKay](https://discourse.julialang.org/u/MeryKay)\
**Post date:** [October 22, 2022, 8:01am UTC](https://discourse.julialang.org/t/jump-constraint-with-limited-dimension-of-an-index/89100/1 "2022-10-22T08:01:48Z")

</div>

Hi everyboday!  
In one constraint, I want to limit my index to a specific intervall within the intervall which is used in all other cases.

More specific this means: index p is normally defined in `p = 1:P` whereby `P=10`  
Now, I want p being limitied by `p >= R[j]` as shown in the picture  
 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/7/d/7d150c6ff17dd283d395df96fcc9535b5c408a61.png)

Is this a way to do this ? or do I have to implement a `for` in front of the constraint?

`@constraint(m, [i=1:M,j=1:N,p=r[j]:P], X[i,j,p] <= Z[i,j,p])`

Thanks in advance for your opinions!

---

<div class="post-metadata">

**Author:** ![BatyLeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/batyleo/32/35017_2.png) [@BatyLeo](https://discourse.julialang.org/u/BatyLeo)\
**Post date:** [October 22, 2022, 9:57am UTC](https://discourse.julialang.org/t/jump-constraint-with-limited-dimension-of-an-index/89100/2 "2022-10-22T09:57:15Z")

</div>

If I’m not mistaken, this should work:

```julia
@constraint(m, [i=1:M, j=1:N, p=1:P; p >= r[j]], X[i,j,p] <= Z[i,j,p])

```
