-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
allow anonymous variables in @variable #735
Conversation
Examples? |
julia> m = Model();
julia> x = @variable(m)
##7145
julia> y = @variable(m, [1:3])
3-element Array{JuMP.Variable,1}:
col_2
col_3
col_4
julia> z = @variable(m, [i=1:4; isodd(i)])
# printing error... |
I like it. Depends on #736 if you want to specify bounds? |
Re: the printing, maybe we should just allow these for |
Yes you'd need #736 for the bounds. I did that first and branched off it, so that's probably the merge conflict. I think it's a bad idea to split things like that. I'd rather just have ugly printing that doesn't throw an error |
Also I'm not 100% sure the hygiene here is right |
Agreed we should support constructing jump containers.
Needs tests :) |
👍 |
I literally just needed this |
I literally still need this |
Lol I just need to motivate myself to clean this up |
Time to revive this? |
@mlubin @IainNZ @chriscoey wanna take a look now? |
Did we settle on full |
We can add category as a keyword argument pretty easily. Annoying corner case: what does x = @variable(m, Int) do? |
We should add a category keyword argument but doesn't need to be in this PR.
|
The category keyword would have been useful for me recently actually. If it's not hard to get in here, it would be nice to have soon. See #741 |
y = @variable(m, [2:3,1:3], upperbound=1.0, lowerbound=0.0, Bin) | ||
z = @variable(m, [[:red,:blue]], Int) | ||
w = @variable(m, [i=1:4,j=1:4;isodd(i+j)], SemiCont) | ||
# v = @variable(m, [i=1:3,j=1:3], Symmetric, lowerbound = eye(3)[i,j]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this commented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The named version was already broken, I have a fix upcoming.
This breaks extensions, right? |
To the extent they were relying on the unexported macro functions, maybe. I think the changes should be backwards compatible, but who knows. |
No description provided.