# Right syntax @constraintref

**URL:** <https://discourse.julialang.org/t/right-syntax-constraintref/11529>\
**Category:** Optimization (Mathematical)\
**Created:** [June 8, 2018, 10:19am UTC](https://discourse.julialang.org/t/right-syntax-constraintref/11529 "2018-06-08T10:19:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [June 8, 2018, 10:19am UTC](https://discourse.julialang.org/t/right-syntax-constraintref/11529/1 "2018-06-08T10:19:16Z")

</div>

I have read the documentation  
[http://www.juliaopt.org/JuMP.jl/0.18/refexpr.html](http://www.juliaopt.org/JuMP.jl/0.18/refexpr.html)  
in order to get the right syntax to build a reference to a constraint. It’s like that:

```julia
@constraintref constraintName[1:3]

```

My constraint is a little bit more complex, and it is represented for a multiple indexation like that

```julia
myConstraint[city, year, product] 

```

I have tried these three ways to build it, but all of them didn’t work and I got an error message :

```julia
@constraintref myConstraint[c in city, y in year, p in product] 
@constraintref myConstraint[for c in city, y in year, p in product] 
@constraintref myConstraint[c, y, p for c in city, y in year, p in product] 

```

Anyone knows the right syntax? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [June 8, 2018, 11:03am UTC](https://discourse.julialang.org/t/right-syntax-constraintref/11529/2 "2018-06-08T11:03:05Z")

</div>

It should be

```julia
@constraintref myConstraint[city, year, product]

```

but there is [a bug](https://github.com/JuliaOpt/JuMP.jl/issues/1329)

---

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [June 8, 2018, 11:18am UTC](https://discourse.julialang.org/t/right-syntax-constraintref/11529/3 "2018-06-08T11:18:28Z")

</div>

Thanks a lot. I hope they can fix this issue.

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [June 8, 2018, 12:38pm UTC](https://discourse.julialang.org/t/right-syntax-constraintref/11529/4 "2018-06-08T12:38:26Z")

</div>

It is fixed by the following PR: [https://github.com/JuliaOpt/JuMP.jl/pull/1330](https://github.com/JuliaOpt/JuMP.jl/pull/1330). The fix should be part of JuMP v0.18.2 but it will probably not be tagged soon so you can checkout the branch `release-0.18` (and even the branch `bl/fix1329` before the PR is merged) if you don’t want to wait 🙂
