-
-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scope of index variables #858
Comments
I'm struggling to see the benefit of allowing this to work. |
There's probably little benefit, since you always can change the variable. I see this more as a question of clear scoping rules. In |
I'm not opposed to making things more consistent but I don't expect to spend any time fixing this soon. PRs will be considered. |
Possibly addressed in Julia 0.7 by JuliaLang/julia#22314 |
This is not addressed by JuliaLang/julia#22314. @constraint(m,[i=1:4],x[i]==x[i+1]) is translated essentially to: for i in 1:4
@constraint(m, x[i] == x[i + 1])
end We would need to mangle the iteration variables to avoid the name conflict. This is feasible to do but still not high priority. The only cases I've seen where users run into this issue is when the model is named |
Rather than make this work, we should just throw an error if the index set has the same name as the model. |
complains that there's no addconstraint method with an Int64 as the first argument. Should this work?
is fine.
The text was updated successfully, but these errors were encountered: