mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 00:18:51 -06:00
FisSal2011: Large LP: Add cuts in small batches
This commit is contained in:
@@ -608,7 +608,7 @@ function collect_gmi_FisSal2011(
|
|||||||
end
|
end
|
||||||
|
|
||||||
@timeit "Computing cut violations" begin
|
@timeit "Computing cut violations" begin
|
||||||
violations = (pool.lb' - (sol_frac' * pool.lhs))'
|
violations = pool.lb - pool.lhs' * sol_frac
|
||||||
end
|
end
|
||||||
|
|
||||||
@timeit "Sorting cut violations" begin
|
@timeit "Sorting cut violations" begin
|
||||||
@@ -619,11 +619,15 @@ function collect_gmi_FisSal2011(
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
@timeit "Add constraint to the model" begin
|
@timeit "Add constraints to the model" begin
|
||||||
push!(selected_idx, σ[1])
|
ncuts = min(max(1, sum(violations .> 1e-6) ÷ 10), length(σ))
|
||||||
cut_lhs = pool.lhs[:, σ[1]]
|
for i in 1:ncuts
|
||||||
|
if violations[σ[i]] <= 1e-6
|
||||||
|
break
|
||||||
|
end
|
||||||
|
cut_lhs = pool.lhs[:, σ[i]]
|
||||||
cut_lhs_value = 0.0
|
cut_lhs_value = 0.0
|
||||||
cut_lb = pool.lb[σ[1]]
|
cut_lb = pool.lb[σ[i]]
|
||||||
cut_expr = AffExpr()
|
cut_expr = AffExpr()
|
||||||
for offset in 1:nnz(cut_lhs)
|
for offset in 1:nnz(cut_lhs)
|
||||||
var_idx = cut_lhs.nzind[offset]
|
var_idx = cut_lhs.nzind[offset]
|
||||||
@@ -635,9 +639,11 @@ function collect_gmi_FisSal2011(
|
|||||||
cut_lhs_value += sol_frac[var_idx] * cut_lhs.nzval[offset]
|
cut_lhs_value += sol_frac[var_idx] * cut_lhs.nzval[offset]
|
||||||
end
|
end
|
||||||
cut_constr = @constraint(model_s, cut_expr >= cut_lb)
|
cut_constr = @constraint(model_s, cut_expr >= cut_lb)
|
||||||
|
push!(selected_idx, σ[i])
|
||||||
push!(selected_contrs, cut_constr)
|
push!(selected_contrs, cut_constr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@timeit "Find dual values for all selected cuts" begin
|
@timeit "Find dual values for all selected cuts" begin
|
||||||
multipliers_curr .= 0
|
multipliers_curr .= 0
|
||||||
|
|||||||
Reference in New Issue
Block a user