Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird warning in birkhoff example #96

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/birkhoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import HiGHS

# For bug hunting:
seed = rand(UInt64)
seed = 0x6a330cff07fe872a
@show seed
seed = 0x3eb09305cecf69f0
Random.seed!(seed)


Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ function build_FW_callback(tree, min_number_lower, check_rounding_value::Bool, f

return true
end
end
end
9 changes: 9 additions & 0 deletions src/custom_bonobo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down