Skip to content

Commit

Permalink
Fixed a bug when restoring master cuts in strong branching (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
artalvpes authored Feb 11, 2021
1 parent 22537e5 commit 03ef7dc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Algorithm/basic/cutcallback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ end

# CutCallbacks does not have child algorithms, therefore get_child_algorithms() is not defined

function get_storages_usage(algo::CutCallbacks, form::Formulation{MathProg.AbstractMasterDuty})
function get_storages_usage(algo::CutCallbacks, form::Formulation{Duty}
) where {Duty<:MathProg.AbstractFormDuty}
return [(form, MasterCutsStoragePair, READ_AND_WRITE)]
end

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 @@ -179,7 +179,7 @@ function perform_strong_branching_with_phases!(
sort!(groups, rev = true, by = x -> (x.isconquered, x.score))

if groups[1].isconquered
nb_candidates_for_next_phase == 1
nb_candidates_for_next_phase = 1
end

# before deleting branching groups which are not kept for the next phase
Expand Down
7 changes: 7 additions & 0 deletions src/Algorithm/storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ const StorageTypePair = Pair{DataType, DataType}
# be restored for writing (all other storages are restored anyway but just for reading)
const StoragesUsageDict = Dict{Tuple{AbstractModel, StorageTypePair}, StorageAccessMode}

function Base.show(io::IO, usagedict::StoragesUsageDict)
print(io, "storage usage dict [")
for usage in usagedict
print(io, " (", typeof(usage[1][1]), ", ", usage[1][2], ") => ", usage[2])
end
print(io, " ]")
end

"""
function add_storage_pair_usage!(::StoragesUsageDict, ::AbstractModel, ::StorageTypePair, ::StorageAccessMode)
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithm/treesearch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function print_node_in_branching_tree_file(
ncur = get_tree_order(node)
time = elapsed_optim_time(env)
if ip_gap_closed(getoptstate(node))
@printf file "\n\tn%i [label= \"N_%i (%.0f s) \\nPRUNED\"];" ncur ncur time
@printf file "\n\tn%i [label= \"N_%i (%.0f s) \\n[PRUNED , %.4f]\"];" ncur ncur time pb
else
@printf file "\n\tn%i [label= \"N_%i (%.0f s) \\n[%.4f , %.4f]\"];" ncur ncur time db pb
end
Expand Down
3 changes: 3 additions & 0 deletions src/Coluna.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const TOL = 1e-8 # if - ϵ_tol < val < ϵ_tol, we consider val = 0
const TOL_DIGITS = 8 # because round(val, digits = n) where n is from 1e-n
###

# submodules
export ColunaBase, MathProg, Algorithm

const _to = TO.TimerOutput()

export Algorithm, ColunaBase, MathProg, Env, DefaultOptimizer, Parameters,
Expand Down
2 changes: 1 addition & 1 deletion src/MOIcallbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function MOI.submit(
end

constr = setconstr!(
form, "", MasterMixedConstr;
form, "", MasterUserCutConstr;
rhs = rhs,
kind = Essential,
sense = sense,
Expand Down
1 change: 1 addition & 0 deletions src/MathProg/duties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ end
MasterRepBendSpTechnologicalConstr <= AbstractMasterRepBendSpConstr
AbstractMasterCutConstr <= AbstractMasterConstr
MasterBendCutConstr <= AbstractMasterCutConstr
MasterUserCutConstr <= AbstractMasterCutConstr
AbstractMasterBranchingConstr <= AbstractMasterConstr
MasterBranchOnOrigVarConstr <= AbstractMasterBranchingConstr
AbstractDwSpConstr <= Duty{Constraint}
Expand Down

0 comments on commit 03ef7dc

Please sign in to comment.