-
Notifications
You must be signed in to change notification settings - Fork 120
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
Array of Variable is Unexpected behavior #223
Comments
I found that "append!" don't work but "push!" works well. |
Maybe you can use other structures to hold the collection of variables instead of array, like tuple or dict? As far as I can see, the array or variables (when it works) may not behave like what you want. |
I implemented my problem without using Thus I was able to use Array for a collection of Variables, but I think overriding |
Note that a = Variable(2)
[a] works fine in the current version of Convex. Regarding A = [Variable(2), Variable(3,4)] the problem seems to be these lines: https://github.com/JuliaOpt/Convex.jl/blob/fe366821b77d8243f2ca21a7deb35f4d50c579ce/src/atoms/affine/stack.jl#L135-L139 What's interesting is that Convex.jl's tests pass when I just comment them out, and moreover A = [Variable(2), Variable(3,4)] works fine. Maybe we can just remove those problematic lines? I see they were introduced years ago in a much older version of Julia, and maybe they are no longer necessary. I will submit a pull request to remove the |
Hello.
I found that I can't make "Array of Variable" by using Convex.jl.
I think it is unexpected behavior but is it a supposed specification?
I think a collection of Variable is useful in some situations and this behavior limits my coding style...
-- simple example
-- and can't make Array of Variable
The text was updated successfully, but these errors were encountered: