-
Notifications
You must be signed in to change notification settings - Fork 16
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
Highs_getRowsByRange is slow #207
Comments
To clarify, what type of constraints is this iterating over? |
All supported ones in direct mode. Nothing esoteric |
I think we decided that this was because it queries the constraint matrix: Lines 1662 to 1708 in 1d192e2
One option would be to use a cache instead of direct_model , so something like model = Model(HiGHS.Optimizer; add_bridges = false) .
I don't think there's an easy way to speed this up in HiGHS.jl. |
Confirm that the issue is O(N) behavior in import HiGHS
import Gurobi
import MathOptInterface as MOI
import Plots
function main(model, N)
x = MOI.add_variables(model, N)
ci = Any[]
for i in 2:N
f = 1.0 * x[i] + 1.0 * x[i-1]
push!(ci, MOI.add_constraint(model, f, MOI.GreaterThan(0.0)))
end
return [MOI.get(model, MOI.ConstraintFunction(), ci_i) for ci_i in ci]
end
function time(model, x)
main(model(), first(x)) # Precompile
y = Float64[]
for N in x
GC.gc()
push!(y, @elapsed main(model(), N))
end
return y
end
x = [1_000, 2_000, 4_000, 8_000, 10_000, 12_000, 14_000, 16_000];
y_grb = time(Gurobi.Optimizer, x);
y_highs = time(HiGHS.Optimizer, x);
y_moi = time(MOI.Utilities.Model{Float64}, x);
plt = Plots.plot(; xlabel = "N", ylabel = "Time [sec]")
Plots.plot!(plt, x, y_grb; label = "Gurobi")
Plots.plot!(plt, x, y_highs; label = "HiGHS")
Plots.plot!(plt, x, y_moi; label = "Utilities.Model") |
@jajhall shall we mark this as expected behavior, or can we make querying rows more efficient? I assume that you store things column-wise. |
Once |
Recently I noticed that the numerical checks in PowerSimulations.jl since it takes a long time to run with HiGHS w.r.t to Gurobi or Xpress.
This is the loop we use is something like this
The text was updated successfully, but these errors were encountered: