|
|
@ -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,23 +619,29 @@ 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
|
|
|
|
cut_lhs_value = 0.0
|
|
|
|
if violations[σ[i]] <= 1e-6
|
|
|
|
cut_lb = pool.lb[σ[1]]
|
|
|
|
break
|
|
|
|
cut_expr = AffExpr()
|
|
|
|
end
|
|
|
|
for offset in 1:nnz(cut_lhs)
|
|
|
|
cut_lhs = pool.lhs[:, σ[i]]
|
|
|
|
var_idx = cut_lhs.nzind[offset]
|
|
|
|
cut_lhs_value = 0.0
|
|
|
|
add_to_expression!(
|
|
|
|
cut_lb = pool.lb[σ[i]]
|
|
|
|
cut_expr,
|
|
|
|
cut_expr = AffExpr()
|
|
|
|
vars_s[var_idx],
|
|
|
|
for offset in 1:nnz(cut_lhs)
|
|
|
|
cut_lhs.nzval[offset],
|
|
|
|
var_idx = cut_lhs.nzind[offset]
|
|
|
|
)
|
|
|
|
add_to_expression!(
|
|
|
|
cut_lhs_value += sol_frac[var_idx] * cut_lhs.nzval[offset]
|
|
|
|
cut_expr,
|
|
|
|
|
|
|
|
vars_s[var_idx],
|
|
|
|
|
|
|
|
cut_lhs.nzval[offset],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
cut_lhs_value += sol_frac[var_idx] * cut_lhs.nzval[offset]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
cut_constr = @constraint(model_s, cut_expr >= cut_lb)
|
|
|
|
|
|
|
|
push!(selected_idx, σ[i])
|
|
|
|
|
|
|
|
push!(selected_contrs, cut_constr)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
cut_constr = @constraint(model_s, cut_expr >= cut_lb)
|
|
|
|
|
|
|
|
push!(selected_contrs, cut_constr)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|