Right syntax @constraintref


I have read the documentation
in order to get the right syntax to build a reference to a constraint. It’s like that:

@constraintref constraintName[1:3]

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

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 :

@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.


It should be

@constraintref myConstraint[city, year, product]

but there is a bug


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


It is fixed by the following PR: 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 :slight_smile: