Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gap test with lazy cuty sep #845

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Algorithm/colgen/printer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,21 @@ end
function _colgen_iter_str(
colgen_iteration, colgen_iter_output::ColGenIterationOutput, phase::Int, sp_time::Float64, mst_time::Float64, optim_time::Float64
)

phase_string = " "
if phase == 1
phase_string = "# "
elseif phase == 2
phase_string = "##"
end
iteration::Int = colgen_iteration


if colgen_iter_output.new_cut_in_master
return @sprintf(
"%s<it=%3i> <et=%5.2f> - new essential cut in master",
phase_string, iteration, optim_time
)
end
if colgen_iter_output.infeasible_master
return @sprintf(
"%s<it=%3i> <et=%5.2f> - infeasible master",
Expand Down
2 changes: 1 addition & 1 deletion src/ColGen/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function run_colgen_iteration!(context, phase, env, ip_primal_sol)
# memoization to calculate reduced costs and stabilization.
new_ip_primal_sol, new_cut_in_master = check_primal_ip_feasibility!(mast_primal_sol, context, phase, get_reform(context), env)
if new_cut_in_master
return new_iteration_output(O, is_min_sense, nothing, nothing, 0, true, false, false, false, false, false, nothing, ip_primal_sol, nothing)
return new_iteration_output(O, is_min_sense, nothing, nothing, 0, true, false, false, false, false, false, nothing, nothing, nothing)
end
if !isnothing(new_ip_primal_sol) && isbetter(new_ip_primal_sol, ip_primal_sol)
ip_primal_sol = new_ip_primal_sol
Expand Down
2 changes: 1 addition & 1 deletion test/e2e_extra/gap/gap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function gap_with_lazy_cuts()
@test JuMP.objective_value(model) ≈ 75.0
@test JuMP.termination_status(model) == MOI.OPTIMAL
end
register!(e2e_extra_tests, "gap", gap_with_lazy_cuts; x = true)
register!(e2e_extra_tests, "gap", gap_with_lazy_cuts)

function gap_with_best_dual_bound()
data = ClD.GeneralizedAssignment.data("play2.txt")
Expand Down
9 changes: 4 additions & 5 deletions test/unit/ColGen/colgen_printer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ register!(unit_tests, "colgen_printer", printer_colgen_iteration_pricing_unbound
function printer_colgen_new_cuts_in_master()
output = Coluna.Algorithm.ColGenIterationOutput(
true,
22.5,
22.5 - 23/4,
1,
nothing,
nothing,
0,
true,
false,
false,
Expand All @@ -147,9 +147,8 @@ function printer_colgen_new_cuts_in_master()
nothing,
nothing
)
expected_str = " <it= 1> <et= 2.34> <mst= 1.23> <sp= 0.12> <cols= 1> <al= 0.00> <DB= 16.7500> <mlp= 22.5000> <PB=Inf>"
expected_str = " <it= 1> <et= 2.34> - new essential cut in master"
str = Coluna.Algorithm._colgen_iter_str(1, output, 3, 0.12, 1.23, 2.34)
@test expected_str == str
end
register!(unit_tests, "colgen_printer", printer_colgen_new_cuts_in_master)