-
-
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
Indexing 0-based JuMPArray: end keyword throws errors #730
Comments
Sorry for the slow reply. Unfortunately I don't think there's much we can do here: the compiler rewrites What do you mean by "this error does not show"? This might be a bug, either on our end or with julia, depending on the behavior. |
@joehuchette, I think it uses the |
The current behavior is dangerous:
|
I'm fine with that |
I wonder if we can return a special object from |
No, that doesn't work because that would break |
@joehuchette: to be precise, I tried a larger piece of code that used to work with JuMP 0.11, and it was broken when I retried with JuMP 0.12. |
|
Maybe the solution is to define |
Replace JuMPDict with Dict. Rewrite JuMPArray to be compatible with AbstractArray. Explicit keyword argument in macro to force container type. Closes #1099 Closes #1047 Closes #417 (collect is now well defined for Array, JuMPArray, and Dict) Closes #833 (`eachindex` and `indices` are defined for JuMPArray) Closes #740 (dot broadcast syntax is now the default, no need to explicitly define vectorized functions) Closes #922 (fixed by checking for duplicates) Closes #933 (corollary: closes #346) Closes #643 (colons work for Array and JuMPArray, obviously not Dict) Closes #730 (end is not supported for JuMPArray) Closes #646 (we now rely on built-in iteration behavior for Dict)
Replace JuMPDict with Dict. Rewrite JuMPArray to be compatible with AbstractArray. Explicit keyword argument in macro to force container type. Closes #1099 Closes #1047 Closes #417 (collect is now well defined for Array, JuMPArray, and Dict) Closes #833 (`eachindex` and `indices` are defined for JuMPArray) Closes #740 (dot broadcast syntax is now the default, no need to explicitly define vectorized functions) Closes #922 (fixed by checking for duplicates) Closes #933 (corollary: closes #346) Closes #643 (colons work for Array and JuMPArray, obviously not Dict) Closes #730 (end is not supported for JuMPArray) Closes #646 (we now rely on built-in iteration behavior for Dict)
When I ran code on an updated JuMP (0.12), indexing arrays of variables at [end] stopped working (while this code perfectly worked in JuMP 0.11). Here is a
The errors I get (for both examples) are:
(By the way, is it normal this error does not show where it was triggered from my code?)
The text was updated successfully, but these errors were encountered: