# Result index of attribute

**URL:** https://discourse.julialang.org/t/result-index-of-attribute/87891
**Category:** Optimization (Mathematical)
**Created:** [September 27, 2022, 7:36pm UTC](https://discourse.julialang.org/t/result-index-of-attribute/87891 "2022-09-27T19:36:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Zizilabg](https://avatars.discourse-cdn.com/v4/letter/z/3da27b/32.png) [@Zizilabg](https://discourse.julialang.org/u/Zizilabg)
#### Post date: [September 27, 2022, 7:36pm UTC](https://discourse.julialang.org/t/result-index-of-attribute/87891/1 "2022-09-27T19:36:56Z")

</div>

Hello,

I wrote a model about Julia which contains 3 constraints. If I test one constraint at a time, each one works. But if I run the whole program, I get the following error message:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/5/b5609429de7d4d8f18e10b81028d6dd138ff2ff7.png)

Has anyone had this problem before and would know where it could be coming from?

It seems to me that the problem comes from a problem between these two constraints:

```julia
#contrainte 2
for j in 1:s
    if ws2[j+1,4] == 1
        @constraint(TB, sum(x[i, j] for i in 1:e) <= 8)
    else
        @constraint(TB, sum(x[i, j] for i in 1:e) <= 12)
    end
end

#contrainte 3
for i in 1:e
    if (ws[i+1,3]==1)
        j = ws[i+1,4]
    @constraint(TB, x[i,j]==1)
    end
end

```

Thanks in advance for your help!

---

<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: [September 27, 2022, 11:41pm UTC](https://discourse.julialang.org/t/result-index-of-attribute/87891/2 "2022-09-27T23:41:01Z")

</div>

As I mentioned here: [Constraints that do not work together - #4 by odow](https://discourse.julialang.org/t/constraints-that-do-not-work-together/87482/4), you need to check if the solver found a solution before attempting to access a primal value.

In this case, your model is probably infeasible.

Read [Debugging · JuMP](https://jump.dev/JuMP.jl/dev/tutorials/getting_started/debugging/#Debugging-an-infeasible-model)
