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 incremental compilation may be fatally broken #852

Merged
merged 1 commit into from
Apr 28, 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
2 changes: 1 addition & 1 deletion src/Algorithm/basic/cutcallback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function run!(algo::CutCallbacks, env::Env, form::Formulation, input::CutCallbac
nb_ess_cuts = 0
nb_fac_cuts = 0
if length(robust_generators) > 0 && (algo.call_robust_facultative || algo.call_robust_essential)
!projection_is_possible(form) && error("Cannot do projection on original variables. Open an issue.")
!MathProg.projection_is_possible(form) && error("Cannot do projection on original variables. Open an issue.")

projsol1 = proj_cols_on_rep(input.primalsol)
projsol2 = Dict{VarId, Float64}(varid => val for (varid, val) in projsol1)
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithm/benders/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function Benders.push_in_set!(ctx::BendersContext, set::CutsSet, sep_result::Ben
return true
end

function Benders.insert_cuts!(reform, ctx, cuts)
function Benders.insert_cuts!(reform, ctx::BendersContext, cuts)
master = Benders.get_master(ctx)
@show cuts

Expand Down
2 changes: 0 additions & 2 deletions src/Algorithm/branchcutprice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ function BranchCutAndPriceAlgorithm(;
BranchingPhase(first(stbranch_phases_num_candidates), RestrMasterLPConquer(), ProductScore())
)
if length(stbranch_phases_num_candidates) >= 3

colgen = ColumnGeneration(
pricing_prob_solve_alg = SolveIpForm(
optimizer_id = tuple.solverid,
user_params = UserOptimize(),
moi_params = MoiOptimize(
deactivate_artificial_vars = false,
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithm/branching/branchingalgo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ClassicBranching <: AlgoAPI.AbstractDivideAlgorithm
end


struct BranchingContext{SelectionCriterion<:Branching.AbstractSelectionCriterion} <: Branching.AbstractDivideContext
struct BranchingContext{SelectionCriterion<:Branching.AbstractSelectionCriterion} <: Branching.AbstractBranchingContext
selection_criterion::SelectionCriterion
rules::Vector{Branching.PrioritisedBranchingRule}
max_nb_candidates::Int
Expand Down
12 changes: 6 additions & 6 deletions src/Algorithm/branching/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ end
Branching.get_children(output::DivideOutput) = output.children
Branching.get_opt_state(output::DivideOutput) = output.optstate

function get_extended_sol(::Branching.AbstractDivideContext, reform, opt_state)
function get_extended_sol(eform, opt_state)
return get_best_lp_primal_sol(opt_state)
end

function get_original_sol(::Branching.AbstractDivideContext, reform, opt_state)
function get_original_sol(reform, opt_state)
extended_sol = get_best_lp_primal_sol(opt_state)
master = getmaster(reform)
original_sol = nothing
if !isnothing(extended_sol)
original_sol = if projection_is_possible(master)
original_sol = if MathProg.projection_is_possible(master)
proj_cols_on_rep(extended_sol)
else
get_best_lp_primal_sol(opt_state) # it means original_sol equals extended_sol(requires discussion)
Expand All @@ -25,7 +25,7 @@ function get_original_sol(::Branching.AbstractDivideContext, reform, opt_state)
end

function Branching.projection_is_possible(::Branching.AbstractDivideContext, reform)
return projection_is_possible(getmaster(reform))
return MathProg.projection_is_possible(getmaster(reform))
end

function run!(algo::AlgoAPI.AbstractDivideAlgorithm, env::Env, reform::Reformulation, input::Branching.AbstractDivideInput)
Expand All @@ -41,8 +41,8 @@ function run!(algo::AlgoAPI.AbstractDivideAlgorithm, env::Env, reform::Reformula
return DivideOutput(SbNode[], optstate)
end

extended_sol = get_extended_sol(ctx, reform, TreeSearch.get_opt_state(parent))
original_sol = get_original_sol(ctx, reform, TreeSearch.get_opt_state(parent))
extended_sol = get_extended_sol(reform, TreeSearch.get_opt_state(parent))
original_sol = get_original_sol(reform, TreeSearch.get_opt_state(parent))

return Branching.run_branching!(ctx, env, reform, input, extended_sol, original_sol)
end
6 changes: 4 additions & 2 deletions src/Branching/Branching.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function select!(rule::AbstractBranchingRule, env, reform, input::Branching.Bran
return BranchingRuleOutput(local_id, candidates)
end

function advanced_select!(ctx::AbstractDivideContext, candidates, _, reform, input::AbstractDivideInput)
abstract type AbstractBranchingContext <: AbstractDivideContext end

function advanced_select!(ctx::AbstractBranchingContext, candidates, _, reform, input::AbstractDivideInput)
children = get_children(first(candidates))
return new_divide_output(children, nothing)
end
Expand All @@ -101,7 +103,7 @@ end
############################################################################################

# Implementation
"Supertype for the branching contexts."
"Supertype for the strong branching contexts."
abstract type AbstractStrongBrContext <: AbstractDivideContext end

"Supertype for the branching phase contexts."
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/gap/generalized_assignment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function gap_toy_instance()
@test MOI.get(model, MOI.NumberOfVariables()) == length(x)
@test MOI.get(model, MOI.SolverName()) == "Coluna"
end
register!(e2e_tests, "gap", gap_toy_instance; f = true)
register!(e2e_tests, "gap", gap_toy_instance)

function gap_strong_branching()
println("\e[45m gap strong branching \e[00m")
Expand Down Expand Up @@ -61,7 +61,7 @@ function gap_strong_branching()
@test JuMP.termination_status(model) == MOI.OPTIMAL
@test ClD.GeneralizedAssignment.print_and_check_sol(data, model, x)
end
register!(e2e_tests, "gap", gap_strong_branching; x = true)
register!(e2e_tests, "gap", gap_strong_branching)


# @testset "Generalized Assignment" begin
Expand Down