-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add batched modification methods #3716
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3716 +/- ##
==========================================
+ Coverage 98.37% 98.41% +0.03%
==========================================
Files 43 43
Lines 5737 5813 +76
==========================================
+ Hits 5644 5721 +77
+ Misses 93 92 -1 ☔ View full report in Codecov by Sentry. |
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.
Looks good, only minor comments
Hey everyone! I tried to use this new dispatch for using JuMP
using HiGHS
model = Model(HiGHS.Optimizer)
@variable(model, x[1:3] >= 0)
@constraint(model, c[i in 1:3], x[i] == i)
constraint_coeffs = Vector{JuMP.ConstraintRef}()
variables = Vector{JuMP.VariableRef}()
coefficients = Vector{Float64}()
for i in 1:3
push!(constraint_coeffs, c[i])
push!(variables, x[i])
push!(coefficients, 5)
end
set_normalized_coefficient(constraint_coeffs, variables, coefficients) And when I am more specific about the type of the constraint reference vector, it works using JuMP
using HiGHS
model = Model(HiGHS.Optimizer)
@variable(model, x[1:3] >= 0)
@constraint(model, c[i in 1:3], x[i] == i)
constraint_coeffs = Vector{JuMP.ConstraintRef{JuMP.Model, MOI.ConstraintIndex{MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}}, ScalarShape}}()
variables = Vector{JuMP.VariableRef}()
coefficients = Vector{Float64}()
for i in 1:3
push!(constraint_coeffs, c[i])
push!(variables, x[i])
push!(coefficients, 5)
end
set_normalized_coefficient(constraint_coeffs, variables, coefficients)
|
@joaquimg I'll fix the error messages. @pedroripper this is expected behavior because of the abstract |
@joaquimg @odow @blegat I just wanted to thank you for this excellent contribution, you are doing amazing work!
|
Modify problems bit by bit can be surprisingly slow in some solvers (like Xpress). Batch modifications like this solve the problems. I was working on a model that changes from 750s to 150s build+modify+solve time after using batch modifications.
rhs
would be weird in plural asrhss
, I don't know what to do about it.