diff --git a/src/Cuts/tableau/gmi_dual.jl b/src/Cuts/tableau/gmi_dual.jl index 808fd9b..b62a1cc 100644 --- a/src/Cuts/tableau/gmi_dual.jl +++ b/src/Cuts/tableau/gmi_dual.jl @@ -327,6 +327,7 @@ function collect_gmi_FisSal2011( pool_cut_age = nothing pool_cut_hashes = Set{UInt64}() pool_size_mb = 0 + tableau_density::Float32 = 0.05 λ, Δ = 0, 0 μ = 10 end @@ -470,7 +471,8 @@ function collect_gmi_FisSal2011( end @timeit "Compute tableau rows" begin - tableau = compute_tableau(data_s, basis, x = sol_frac, rows = selected_rows) + tableau = compute_tableau(data_s, basis, x = sol_frac, rows = selected_rows, estimated_density=tableau_density * 1.05) + tableau_density = nnz(tableau.lhs) / length(tableau.lhs) assert_eq(tableau.lhs * sol_frac, tableau.rhs, atol=1e-3) assert_eq(tableau.lhs * sol_opt_s, tableau.rhs, atol=1e-3) end diff --git a/src/Cuts/tableau/tableau.jl b/src/Cuts/tableau/tableau.jl index 961dc2c..4e23721 100644 --- a/src/Cuts/tableau/tableau.jl +++ b/src/Cuts/tableau/tableau.jl @@ -58,6 +58,7 @@ function compute_tableau( x::Union{Nothing,Vector{Float64}} = nothing, rows::Union{Vector{Int},Nothing} = nothing, tol = 1e-8, + estimated_density = 0.10, )::Tableau @timeit "Split data" begin nrows, ncols = size(data.constr_lhs) @@ -78,7 +79,7 @@ function compute_tableau( tableau_lhs_I::Array{Int} = Int[] tableau_lhs_J::Array{Int} = Int[] tableau_lhs_V::Array{Float64} = Float64[] - estimated_nnz::Int = length(rows) * ncols ÷ 20 + estimated_nnz::Int = round(length(rows) * ncols * estimated_density) sizehint!(tableau_lhs_I, estimated_nnz) sizehint!(tableau_lhs_J, estimated_nnz) sizehint!(tableau_lhs_V, estimated_nnz)