Skip to content

Commit

Permalink
Some more modifs due to Guillaume comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Sadykov authored and Ruslan Sadykov committed May 15, 2021
1 parent 1351829 commit 63ee7ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
7 changes: 4 additions & 3 deletions src/Algorithm/conquer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ end
Column-and-cut-generation based algorithm to find primal and dual bounds for a
problem decomposed using Dantzig-Wolfe paradigm. It applies `stages` of the column generation
algorithm (for example, the exact stage and the heuristic stage), `cutgen` for the cut
generation phase, and it can apply several primal
heuristics to more efficiently find feasible solutions.
algorithm. Stages are called in the reverse order of vector `stages`. So usually, first stage
is the one with exact pricing, and other stages use heuristic pricing (the higher is stage,
the faster is the heuristic). It applies `cutgen` for the cut generation phase. It can apply
several primal heuristics to more efficiently find feasible solutions.
"""
@with_kw struct ColCutGenConquer <: AbstractConquerAlgorithm
stages::Vector{ColumnGeneration} = [ColumnGeneration()]
Expand Down
12 changes: 6 additions & 6 deletions src/Algorithm/pricing.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@with_kw struct DefaultPricing <: AbstractOptimizationAlgorithm
callbackalg::PricingCallback = PricingCallback()
MIPalg::SolveIpForm = SolveIpForm(deactivate_artificial_vars=false, enforce_integrality=false, log_level=2)
pricing_callback::PricingCallback = PricingCallback()
solve_ip_form::SolveIpForm = SolveIpForm(deactivate_artificial_vars=false, enforce_integrality=false, log_level=2)
dispatch::Int = 0 # 0 - automatic, 1 - impose pricing callback, 2 - impose pricing by MIP
end

function get_child_algorithms(algo::DefaultPricing, spform::Formulation{DwSp})
child_algs = Tuple{AbstractAlgorithm,AbstractModel}[]
algo.dispatch != 2 && push!(child_algs, (algo.callbackalg, spform))
algo.dispatch != 1 && push!(child_algs, (algo.MIPalg, spform))
algo.dispatch != 2 && push!(child_algs, (algo.pricing_callback, spform))
algo.dispatch != 1 && push!(child_algs, (algo.solve_ip_form, spform))
return child_algs
end

Expand All @@ -18,8 +18,8 @@ function run!(algo::DefaultPricing, env::Env, spform::Formulation{DwSp}, input::
end

if algo.dispatch != 2 && isa(getuseroptimizer(spform), UserOptimizer)
return run!(algo.callbackalg, env, spform, input)
return run!(algo.pricing_callback, env, spform, input)
end

return run!(algo.MIPalg, env, spform, input)
return run!(algo.solve_ip_form, env, spform, input)
end
7 changes: 0 additions & 7 deletions src/decomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,6 @@ function getmoioptbuilder(prob::Problem, ann::BD.Annotation)
return prob.default_optimizer_builder
end

function getuseroptbuilder(prob::Problem, ann::BD.Annotation)
if BD.getpricingoracle(ann) !== nothing
return () -> UserOptimizer(BD.getpricingoracle(ann))
end
return prob.default_optimizer_builder
end

function buildformulations!(
prob::Problem, reform::Reformulation, env::Env, annotations::Annotations, parent,
node::BD.Root
Expand Down
4 changes: 2 additions & 2 deletions test/pricing_callback_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ function pricing_callback_tests()
conqueralg = ClA.ColCutGenConquer(
stages = [ClA.ColumnGeneration(
pricing_prob_solve_alg = ClA.DefaultPricing(
dispatch=1, callbackalg = PricingCallback(stage=1)
dispatch=1, pricing_callback = PricingCallback(stage=1)
)),
ClA.ColumnGeneration(
pricing_prob_solve_alg = ClA.DefaultPricing(
dispatch=1, callbackalg = PricingCallback(stage=2)
dispatch=1, pricing_callback = PricingCallback(stage=2)
))
]
)
Expand Down

0 comments on commit 63ee7ff

Please sign in to comment.