FisSal2011: Accelerate creation of obj function

fs11_01
Alinson S. Xavier 2 months ago
parent 3ca5a4fec7
commit e2906a0a7e

@ -389,10 +389,15 @@ function collect_gmi_FisSal2011(
log_should_print = false log_should_print = false
if round > 1 if round > 1
@timeit "Update objective function" begin @timeit "Build Lagrangian term" begin
# Build Lagrangian term @timeit "mul" begin
v = sparse(pool.lhs * multipliers_curr) active_idx = findall(multipliers_curr .> 1e-6)
v = sparse(pool.lhs[:, active_idx] * multipliers_curr[active_idx])
end
@timeit "dot" begin
lagr_term = AffExpr(dot(multipliers_curr, pool.lb)) lagr_term = AffExpr(dot(multipliers_curr, pool.lb))
end
@timeit "add_to_expression!" begin
for offset in 1:nnz(v) for offset in 1:nnz(v)
var_idx = v.nzind[offset] var_idx = v.nzind[offset]
add_to_expression!( add_to_expression!(
@ -401,8 +406,9 @@ function collect_gmi_FisSal2011(
- v.nzval[offset], - v.nzval[offset],
) )
end end
end
# Update objective end
@timeit "Update objective" begin
set_objective_function( set_objective_function(
model_s, model_s,
orig_obj_s + lagr_term, orig_obj_s + lagr_term,

Loading…
Cancel
Save