# Cannot set an array of constraints @constraint, getting an error

**URL:** <https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [March 31, 2023, 4:57pm UTC](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901 "2023-03-31T16:57:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregoryo](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@Gregoryo](https://discourse.julialang.org/u/Gregoryo)\
**Post date:** [March 31, 2023, 4:57pm UTC](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901/1 "2023-03-31T16:57:15Z")

</div>

Hi, I want to create a constraint in my model where I have np particles with a mass m at position x,y as variables. I want to set the constraint that the mass of particles is \>0 and I wrote the code below but I get an error

my\_model = Model(Ipopt.Optimizer)  
set\_optimizer\_attribute(my\_model, “print\_level”, 0)

# Define the variables for the m, x and y coordinates of each particle

@variables(my\_model, begin  
m[1:np]  
x[1:np]  
y[1:np]  
end)

# set mass constraint to be \>0

@constraint(my\_model,c[i=1:np], m[i]\>0)

The error I am getting is the following  
LoadError: At /Users/Greg/Documents/OneDrive/Documents/Julia Code/Scalar points optimizer:32: `@constraint(my_model, c[i = 1:np], m[i] > 0)`: Unrecognized sense \>

Any help super appreciated. Cheers, Greg

---

<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:** [March 31, 2023, 10:42pm UTC](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901/2 "2023-03-31T22:42:05Z")

</div>

> [@Gregoryo](#):
>
> @constraint(my\_model, c[i = 1:np], m[i] \> 0)

You cannot use strict inequalities in JuMP. You need to use `>=`. I should improve this error message.

Edit: [Fix error message for unrecognized sense by odow · Pull Request #3311 · jump-dev/JuMP.jl · GitHub](https://github.com/jump-dev/JuMP.jl/pull/3311)

---

<div class="post-metadata">

**Author:** ![Gregoryo](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@Gregoryo](https://discourse.julialang.org/u/Gregoryo)\
**Post date:** [April 1, 2023, 5:15am UTC](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901/3 "2023-04-01T05:15:27Z")

</div>

Thank you! I’ll adjust my constraint accordingly with some epsilon boundary. Have a great day
