From 9c1d55cc28052bbdd3e7eac65d4695de5693697b Mon Sep 17 00:00:00 2001 From: dhendryc Date: Wed, 31 Aug 2022 14:25:13 +0200 Subject: [PATCH] Print outs to hunt down location of the warning. --- examples/birkhoff.jl | 4 ++-- src/callbacks.jl | 2 +- src/custom_bonobo.jl | 9 +++++++++ src/node.jl | 7 +++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/examples/birkhoff.jl b/examples/birkhoff.jl index e701e38e0..1c21be5f0 100644 --- a/examples/birkhoff.jl +++ b/examples/birkhoff.jl @@ -14,8 +14,8 @@ import HiGHS # For bug hunting: seed = rand(UInt64) +seed = 0x6a330cff07fe872a @show seed -seed = 0x3eb09305cecf69f0 Random.seed!(seed) @@ -33,7 +33,7 @@ Random.seed!(seed) # The variables are ordered (Y, X, theta) in the MOI model # the objective only uses the last n^2 variables # Small dimensions since the size of the problem grows quickly (2 k n^2 + k variables) -n = 3 +n = 5 k = 2 # generate random doubly stochastic matrix diff --git a/src/callbacks.jl b/src/callbacks.jl index b96e42971..722b3705c 100644 --- a/src/callbacks.jl +++ b/src/callbacks.jl @@ -83,4 +83,4 @@ function build_FW_callback(tree, min_number_lower, check_rounding_value::Bool, f return true end -end \ No newline at end of file +end diff --git a/src/custom_bonobo.jl b/src/custom_bonobo.jl index e873595e9..b1203b46b 100644 --- a/src/custom_bonobo.jl +++ b/src/custom_bonobo.jl @@ -30,7 +30,10 @@ function Bonobo.optimize!(tree::Bonobo.BnBTree{<:FrankWolfeNode}; callback=(args #println("OWN OPTIMIZE") while !Bonobo.terminated(tree) node = Bonobo.get_next_node(tree, tree.options.traverse_strategy) + println("get_next_node") + @show node.id lb, ub = Bonobo.evaluate_node!(tree, node) + println("evaluate_node") # if the problem was infeasible we simply close the node and continue if isnan(lb) && isnan(ub) Bonobo.close_node!(tree, node) @@ -39,6 +42,7 @@ function Bonobo.optimize!(tree::Bonobo.BnBTree{<:FrankWolfeNode}; callback=(args end Bonobo.set_node_bound!(tree.sense, node, lb, ub) + println("set_node_bound") # if the evaluated lower bound is worse than the best incumbent -> close and continue if node.lb >= tree.incumbent @@ -56,16 +60,21 @@ function Bonobo.optimize!(tree::Bonobo.BnBTree{<:FrankWolfeNode}; callback=(args @assert p_lb <= tree.lb updated = Bonobo.update_best_solution!(tree, node) + println("update_best_solution") if updated Bonobo.bound!(tree, node.id) + println("bound") if isapprox(tree.incumbent, tree.lb; atol=tree.options.atol, rtol=tree.options.rtol) break end end Bonobo.close_node!(tree, node) + println("close_node") Bonobo.branch!(tree, node) + println("branch") callback(tree, node) + println("callback\n") end Bonobo.sort_solutions!(tree.solutions, tree.sense) end diff --git a/src/node.jl b/src/node.jl index ccabd08f6..eadecce0c 100644 --- a/src/node.jl +++ b/src/node.jl @@ -108,9 +108,12 @@ function Bonobo.evaluate_node!(tree::Bonobo.BnBTree, node::FrankWolfeNode) restart_active_set(node, tree.root.problem.lmo.lmo, tree.root.problem.nvars) end + if node.id == 41 + nothing + end # time tracking FW time_ref = Dates.now() - + println("BEFORE evaluation") # call blended_pairwise_conditional_gradient x,_,primal,dual_gap,_ , active_set = FrankWolfe.blended_pairwise_conditional_gradient( tree.root.problem.f, @@ -126,7 +129,7 @@ function Bonobo.evaluate_node!(tree::Bonobo.BnBTree, node::FrankWolfeNode) callback=tree.root.options[:callback], lazy=true, ) - + println("AFTER evaluation") node.fw_time = Dates.now() - time_ref # update active set of the node