cuts: Speed up tableau computation

feature/replay^2
Alinson S. Xavier 1 year ago
parent 2f16f04878
commit ffea599af3
Signed by: isoron
GPG Key ID: 0DA8E4B9E1109DCA

@ -74,11 +74,11 @@ function compute_tableau(
end end
@timeit "Compute tableau" begin @timeit "Compute tableau" begin
tableau_rhs = [] @timeit "Initialize" begin
tableau_lhs_I = Int[] tableau_rhs = zeros(length(rows))
tableau_lhs_J = Int[] tableau_lhs = zeros(length(rows), ncols)
tableau_lhs_V = Float64[] end
for k = 1:length(rows) for k in eachindex(1:length(rows))
@timeit "Prepare inputs" begin @timeit "Prepare inputs" begin
i = rows[k] i = rows[k]
e = zeros(nrows) e = zeros(nrows)
@ -88,23 +88,14 @@ function compute_tableau(
sol = factor \ e sol = factor \ e
end end
@timeit "Multiply" begin @timeit "Multiply" begin
row = sol' * data.constr_lhs tableau_lhs[k, :] = sol' * data.constr_lhs
rhs = sol' * data.constr_ub tableau_rhs[k] = sol' * data.constr_ub
push!(tableau_rhs, rhs)
end
@timeit "Sparsify & copy" begin
for (j, v) in enumerate(row)
if abs(v) < tol
continue
end
push!(tableau_lhs_I, k)
push!(tableau_lhs_J, j)
push!(tableau_lhs_V, v)
end
end end
end end
tableau_lhs = @timeit "Sparsify" begin
sparse(tableau_lhs_I, tableau_lhs_J, tableau_lhs_V, length(rows), ncols) tableau_lhs[abs.(tableau_lhs) .<= tol] .= 0
tableau_lhs = sparse(tableau_lhs)
end
end end
@timeit "Compute tableau objective row" begin @timeit "Compute tableau objective row" begin

Loading…
Cancel
Save