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

Support blmo type and passed test for Cube polytope #188

Draft
wants to merge 266 commits into
base: main
Choose a base branch
from

Conversation

WenjieXiao-2022
Copy link

@WenjieXiao-2022 WenjieXiao-2022 commented May 3, 2024

Modified code in frank_wolfe_variants.jl, Boscia.jl, node.jl, polytope_blmos.jl, time_tracking_lmo.jl, managed_blmo.jl.

All changed or added code is wrapped by
#=========================#
......
#=========================#

@dhendryc dhendryc linked an issue Jun 13, 2024 that may be closed by this pull request
adding pre_computed_set for DICG
supporting pre_computed_set in DICG
add split_pre_computed_set! function
adding pre_computed_set arg for DICG
src/node.jl Outdated Show resolved Hide resolved
src/node.jl Outdated Show resolved Hide resolved
src/utilities.jl Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to add the other DICG functions as well. They can have some default behaviour, i.e. throw an error that this is not implemented yet.

end

return true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to return something at the end.

Comment on lines -55 to -59
if (state.primal - state.dual_gap > tree.incumbent + 1e-2) &&
tree.num_nodes != 1 &&
state.t > min_fw_iterations
return false
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to have has little duplicate code as possible.
I understand that the signature is different but the two callbacks still do nearly the same thing.

Comment on lines +221 to +239
function make_callback(pre_computed_set)
return function DICG_callback(state, args...)
if !callback(state, args...)
return false
end

if state.tt !== FrankWolfe.last || state.tt !== FrankWolfe.pp
idx = findfirst(x -> x == state.v, pre_computed_set)

The standard variant of Frank-Wolfe. In each iteration, the vertex v minimizing ∇f * (x-v) is computed.
if idx == nothing && length(pre_computed_set) < (length(state.v) + 1)
push!(pre_computed_set, state.v)
end

end

return true
end
end
DICG_callback = make_callback(pre_computed_set)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this to our callback instead.

Comment on lines +171 to +177
if use_DICG_warm_start
# For DICG, we use PrecomputedSet instead of ActiveSet to store information.
pre_computed_set = [v]
else
pre_computed_set = nothing
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write this in a single line as
pre_computed_set = use_DICG_warm_start ? [v] : nothing

Comment on lines +317 to +321
if tree.root.options[:variant] != DICG()
fw_callback = build_FW_callback(tree, min_number_lower, true, fw_iterations, min_fw_iterations, time_ref, tree.root.options[:time_limit])
else
fw_callback = build_FW_callback(tree, min_number_lower, true, fw_iterations, min_fw_iterations, time_ref, tree.root.options[:time_limit]; use_DICG=true)
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make to shorter,
fw_callback = build_FW_callback(tree, min_number_lower, true, fw_iterations, min_fw_iterations, time_ref, tree.root.options[:time_limit], use_DICG=tree.root.options[:varinat] == DICG())

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using DICG
3 participants