Skip to content

Commit

Permalink
Skip rest mast ip heur if integer var unsupported (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimarqu authored Oct 16, 2019
1 parent cb355de commit 72da1ab
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/algorithms/masteripheur.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ function run!(algo::MasterIpHeuristic, form, node)
@logmsg LogLevel(1) "Applying Master IP heuristic"
master = getmaster(form)
algorithm_data = MasterIpHeuristicData(getobjsense(master))
deactivate!(master, MasterArtVar)
enforce_integrality!(master)
opt_result = optimize!(master)
relax_integrality!(master)
activate!(master, MasterArtVar)
update_ip_primal_sol!(algorithm_data.incumbents, getbestprimalsol(opt_result))
@logmsg LogLevel(1) string("Found primal solution of ", get_ip_primal_bound(algorithm_data.incumbents))
@logmsg LogLevel(-3) get_ip_primal_sol(algorithm_data.incumbents)
# Record data
update_ip_primal_sol!(node.incumbents, get_ip_primal_sol(algorithm_data.incumbents))
if MOI.supports_constraint(getoptimizer(form.master).inner, MOI.SingleVariable, MOI.Integer)
deactivate!(master, MasterArtVar)
enforce_integrality!(master)
opt_result = optimize!(master)
relax_integrality!(master)
activate!(master, MasterArtVar)
update_ip_primal_sol!(algorithm_data.incumbents, getbestprimalsol(opt_result))
@logmsg LogLevel(1) string("Found primal solution of ", get_ip_primal_bound(algorithm_data.incumbents))
@logmsg LogLevel(-3) get_ip_primal_sol(algorithm_data.incumbents)
# Record data
update_ip_primal_sol!(node.incumbents, get_ip_primal_sol(algorithm_data.incumbents))
else
@warn "Master optimizer does not support integer variables. Skip Restricted IP Master Heuristic."
end
return MasterIpHeuristicRecord(algorithm_data.incumbents)
end

0 comments on commit 72da1ab

Please sign in to comment.