Skip to content
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

setlowerbound & setupperbound for vectors #945

Closed
cossio opened this issue Jan 24, 2017 · 4 comments
Closed

setlowerbound & setupperbound for vectors #945

cossio opened this issue Jan 24, 2017 · 4 comments

Comments

@cossio
Copy link
Contributor

cossio commented Jan 24, 2017

Is it possible to extend setlowerbound and setupperbound for vectors? Basically, I want to avoid to have to write something like:

for i = 1:M
   JuMP.setlowerbound(x[i], lb[i])
end

when I could just write:

JuMP.setlowerbound(x, lb)

and let JuMP do the loop.

@mlubin
Copy link
Member

mlubin commented Jan 24, 2017

You can now do JuMP.setlowerbound.(x, lb) so it's not clear why we need to manually vectorize this in JuMP. But anyway this is a dup of #740.

@mlubin mlubin closed this as completed Jan 24, 2017
@cossio
Copy link
Contributor Author

cossio commented Jan 24, 2017

@mlubin What version? I am using JuMP 0.15 and setlowerbound(x, lb) gives an error:

ERROR: MethodError: no method matching setlowerbound(::Array{JuMP.Variable,1}, ::Array{Float64,1})

@mlubin
Copy link
Member

mlubin commented Jan 24, 2017

Julia 0.5 and later

@cossio
Copy link
Contributor Author

cossio commented Jan 24, 2017

Oh, sorry, I missed the dot. Yes, you are right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants