Skip to content

Commit

Permalink
Fix gap small instance extra e2e test (#840)
Browse files Browse the repository at this point in the history
* wip

* test ok

* Apply suggestions from code review

* broken test ok

* ok
  • Loading branch information
guimarqu authored Apr 26, 2023
1 parent a1bcbf5 commit fcfd847
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/Algorithm/benders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ end
function bend_cutting_plane_main_loop!(
algo::BendersCutGeneration, env::Env, algdata::BendersCutGenRuntimeData, reform::Reformulation
)

nb_bc_iterations = 0
masterform = getmaster(reform)
one_spsol_is_a_relaxed_sol = false
Expand Down
5 changes: 5 additions & 0 deletions src/Algorithm/colgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ function run!(algo::ColumnGeneration, env::Env, reform::Reformulation, input::Op
if !isnothing(result.master_ip_primal_sol)
update_ip_primal_sol!(optstate, result.master_ip_primal_sol)
end

if !isnothing(result.db)
set_lp_dual_bound!(optstate, DualBound(master, result.db))
set_ip_dual_bound!(optstate, DualBound(master, result.db))
end
return optstate
end

Expand Down
4 changes: 2 additions & 2 deletions src/Algorithm/colgen/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ function ColGen.check_primal_ip_feasibility!(master_lp_primal_sol, ctx::ColGenCo
end
# Check if violated essential cuts
new_cut_in_master = _violates_essential_cuts!(ColGen.get_master(ctx), master_lp_primal_sol, env)
# Returns projection on original variables if feasible and integral.
return MathProg.proj_cols_on_rep(master_lp_primal_sol), new_cut_in_master
# Returns disaggregated solution if feasible and integral.
return master_lp_primal_sol, new_cut_in_master
end

ColGen.isbetter(new_ip_primal_sol::PrimalSolution, ip_primal_sol::Nothing) = true
Expand Down
2 changes: 1 addition & 1 deletion src/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function optimize!(
ip_primal_sols = get_ip_primal_sols(algstate)
if !isnothing(ip_primal_sols)
for sol in ip_primal_sols
add_ip_primal_sol!(outstate, sol)
add_ip_primal_sol!(outstate, proj_cols_on_rep(sol))
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/e2e_extra/advanced_colgen/pricing_callback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ function gap_with_pricing_callback_and_stages()
# a little bit with versions due to numerical errors.
@test JuMP.objective_value(model) 75.0
@test JuMP.termination_status(model) == MOI.OPTIMAL
@test_broken ClD.GeneralizedAssignment.print_and_check_sol(data, model, x)
@test ClD.GeneralizedAssignment.print_and_check_sol(data, model, x)
end
register!(e2e_extra_tests, "pricing_callback", gap_with_pricing_callback_and_stages)
2 changes: 1 addition & 1 deletion test/e2e_extra/gap/gap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function gap_small_instance()
@test JuMP.termination_status(model) == MOI.OPTIMAL
@test ClD.GeneralizedAssignment.print_and_check_sol(data, model, x)
end
register!(e2e_extra_tests, "gap", gap_small_instance; x = true)
register!(e2e_extra_tests, "gap", gap_small_instance)

function gap_node_limit()
data = ClD.GeneralizedAssignment.data("mediumgapcuts3.txt")
Expand Down

0 comments on commit fcfd847

Please sign in to comment.