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

Print incumbent ip primal sol value in colgen #813

Merged
merged 1 commit into from
Apr 12, 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
11 changes: 9 additions & 2 deletions src/Algorithm/colgen/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mutable struct ColGenContext <: ColGen.AbstractColGenContext
opt_rtol::Float64
opt_atol::Float64

incumbent_primal_solution::PrimalSolution
incumbent_primal_solution::Union{Nothing,PrimalSolution}

# # Information to solve the master
# master_solve_alg
Expand All @@ -39,7 +39,8 @@ mutable struct ColGenContext <: ColGen.AbstractColGenContext
alg.throw_column_already_inserted_warning,
alg.max_nb_iterations,
alg.opt_rtol,
alg.opt_atol
alg.opt_atol,
nothing
)
end
end
Expand Down Expand Up @@ -219,10 +220,16 @@ function ColGen.update_master_constrs_dual_vals!(ctx::ColGenContext, phase, refo
end

function ColGen.check_primal_ip_feasibility(master_lp_primal_sol, ::ColGenContext, phase, reform)
# Check if feasible.
if contains(master_lp_primal_sol, varid -> isanArtificialDuty(getduty(varid)))
return nothing
end
# Check if integral.
primal_sol_is_integer = MathProg.proj_cols_is_integer(master_lp_primal_sol)
if !primal_sol_is_integer
return nothing
end
# Returns projection on original variables if feasible and integral.
return MathProg.proj_cols_on_rep(master_lp_primal_sol)
end

Expand Down
10 changes: 9 additions & 1 deletion src/Algorithm/colgen/printer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ end

ColGen.before_colgen_iteration(ctx::ColGenPrinterContext, phase) = nothing

function _get_inc_pb(ctx::ColGenPrinterContext)
sol = ctx.inner.incumbent_primal_solution
if isnothing(sol)
return Inf
end
return getvalue(sol)
end

function _iter_str(ctx::ColGenPrinterContext, phase, env, colgen_iteration, colgen_iter_output::ColGen.AbstractColGenIterationOutput)
mlp = colgen_iter_output.mlp
db = colgen_iter_output.db
pb = 100000
pb = _get_inc_pb(ctx)

phase_string = " "
if ctx.phase == 1
Expand Down