Skip to content

Commit

Permalink
Merge commit '1a76e243df489459286f139de5d0db8e78824ce8' into branchin…
Browse files Browse the repository at this point in the history
…g_priority

# Conflicts:
#	src/Algorithm/presolve/propagation.jl
  • Loading branch information
rrsadykov committed Dec 8, 2023
2 parents fb5d898 + 1a76e24 commit 99a05d5
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 41 deletions.
36 changes: 18 additions & 18 deletions src/Algorithm/presolve/propagation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,29 @@ function partial_sol_on_repr(
if abs(partial_sol_value) > Coluna.TOL
var = presolve_master_restr.col_to_var[col]
varid = getid(var)
if !(getduty(varid) <= MasterCol)
master_repr_var_col = get(presolve_master_repr.var_to_col, varid, nothing)
if !isnothing(master_repr_var_col)
partial_solution[master_repr_var_col] += partial_sol_value
if getduty(varid) <= MasterCol
spid = getoriginformuid(varid)
spform = get(dw_sps, spid, nothing)
@assert !isnothing(spform)
column = @view get_primal_sol_pool(spform).solutions[varid,:]
for (varid, val) in column
getduty(varid) <= DwSpPricingVar || continue
master_repr_var_col = get(presolve_master_repr.var_to_col, varid, nothing)
if !isnothing(master_repr_var_col)
partial_solution[master_repr_var_col] += val * partial_sol_value
end
if !new_column_explored
nb_fixed_columns[spid] += partial_sol_value
new_column_explored = true
end
end
continue
end
spid = getoriginformuid(varid)
spform = get(dw_sps, spid, nothing)
@assert !isnothing(spform)
column = @view get_primal_sol_pool(spform).solutions[varid,:]
for (varid, val) in column
getduty(varid) <= DwSpPricingVar || continue
new_column_explored = false
elseif getduty(varid) <= MasterPureVar
master_repr_var_col = get(presolve_master_repr.var_to_col, varid, nothing)
if !isnothing(master_repr_var_col)
partial_solution[master_repr_var_col] += val * partial_sol_value
end
if !new_column_explored
nb_fixed_columns[spid] += partial_sol_value
new_column_explored = true
partial_solution[master_repr_var_col] += partial_sol_value
end
end
new_column_explored = false
end
end
return partial_solution, nb_fixed_columns
Expand Down
41 changes: 21 additions & 20 deletions test/e2e/gap/generalized_assignment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ function gap_toy_instance()

coluna = JuMP.optimizer_with_attributes(
Coluna.Optimizer,
"params" => CL.Params(solver = ClA.BranchCutAndPriceAlgorithm(
branchingtreefile = "playgap.dot",
),local_art_var_cost = 10000.0,
global_art_var_cost = 100000.0),
"params" => CL.Params(solver=ClA.BranchCutAndPriceAlgorithm(
branchingtreefile="playgap.dot",
), local_art_var_cost=10000.0,
global_art_var_cost=100000.0),
"default_optimizer" => GLPK.Optimizer
)

Expand All @@ -31,10 +31,10 @@ function gap_toy_instance_2()

coluna = JuMP.optimizer_with_attributes(
Coluna.Optimizer,
"params" => CL.Params(solver = ClA.BranchCutAndPriceAlgorithm(
jsonfile = "playgap.json",
),local_art_var_cost = 10000.0,
global_art_var_cost = 100000.0),
"params" => CL.Params(solver=ClA.BranchCutAndPriceAlgorithm(
jsonfile="playgap.json",
), local_art_var_cost=10000.0,
global_art_var_cost=100000.0),
"default_optimizer" => GLPK.Optimizer
)

Expand All @@ -60,12 +60,12 @@ function gap_strong_branching()
coluna = JuMP.optimizer_with_attributes(
CL.Optimizer,
"params" => CL.Params(
solver = ClA.BranchCutAndPriceAlgorithm(
maxnumnodes = 300,
colgen_stabilization = 1.0,
colgen_cleanup_threshold = 150,
stbranch_phases_num_candidates = [10, 3, 1],
stbranch_intrmphase_stages = [(userstage=1, solverid=1, maxiters=2)]
solver=ClA.BranchCutAndPriceAlgorithm(
maxnumnodes=300,
colgen_stabilization=1.0,
colgen_cleanup_threshold=150,
stbranch_phases_num_candidates=[10, 3, 1],
stbranch_intrmphase_stages=[(userstage=1, solverid=1, maxiters=2)]
)
),
"default_optimizer" => GLPK.Optimizer
Expand All @@ -74,11 +74,12 @@ function gap_strong_branching()
model, x, dec = ClD.GeneralizedAssignment.model(data, coluna)

# we increase the branching priority of variables which assign jobs to the first two machines
for machine in 1:2
for job in data.jobs
BD.branchingpriority!(x[machine,job], 2)
end
end
for job in data.jobs
BD.branchingpriority!(x[1, job], 2)
end
for job in data.jobs
BD.branchingpriority!(x[2, job], 2.0)
end

BD.objectiveprimalbound!(model, 2000.0)
BD.objectivedualbound!(model, 0.0)
Expand Down Expand Up @@ -111,7 +112,7 @@ register!(e2e_tests, "gap", gap_strong_branching)
# @test JuMP.termination_status(model) == MOI.OPTIMAL
# @test ClD.GeneralizedAssignment.print_and_check_sol(data, model, x)
# end


# @testset "node limit" begin # TODO -> replace by unit test for tree search algorithm
# data = ClD.GeneralizedAssignment.data("mediumgapcuts3.txt")
Expand Down
2 changes: 2 additions & 0 deletions test/e2e_extra/advanced_colgen/non_robust_cuts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct MyCustomVarData <: BD.AbstractCustomVarData
nb_items::Int
end

BD.branchingpriority(::MyCustomVarData) = 0.5

struct MyCustomCutData <: BD.AbstractCustomConstrData
min_items::Int
end
Expand Down
Loading

0 comments on commit 99a05d5

Please sign in to comment.