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

Pseudo-branching #190

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

Pseudo-branching #190

wants to merge 52 commits into from

Conversation

LeChStan
Copy link

@LeChStan LeChStan commented Jun 5, 2024

No description provided.

@dhendryc dhendryc self-requested a review June 5, 2024 10:56
dhendryc
dhendryc previously approved these changes Jun 17, 2024

n = 6

const diffw = 0.5 * ones(n)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For testing, this is fine. Just beware that in this case all possible nodes will be created and evaluated because any vertex of the hypercube is optimal. The diffw from the approx planted point example might be the better choice.

heu = Boscia.Heuristic((tree, blmo, x) -> Boscia.follow_gradient_heuristic(tree,blmo,x, depth), 0.2, :follow_gradient)
heuristics = [heu]
# heuristics = []
iterations_stable = 3::Int# how many times until we consider a pseudocost as stable
Copy link
Collaborator

Choose a reason for hiding this comment

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

The ::Int should not be necessary.

branching::PSEUDO_COST{BLMO}
) where BLMO <: BoundedLinearMinimizationOracle
@assert !isempty(node.active_set)
active_set = copy(node.active_set)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are emptying the active set anyway, you can just create an empty one: https://github.com/ZIB-IOL/FrankWolfe.jl/blob/9009acab5d397d71cedee6156977d7d92f79b0b6/src/active_set.jl#L27

The active sets can be come quite large and copying them might lead to some unnecessary overhead.

@LeChStan
Copy link
Author

LeChStan commented Jul 10, 2024

This version seems to work. It has been tested on the sparse_regression example where occasionaly decisions are made based on pseudocosts. I have yet to observe an instance where after some time all decisions are made on pseudocost knowledge, i.e. some variables don´t meet the requirement even after other variables have been branched on tens of times. Requirement for testing was that a variable has been branched up and down at least once.

On the Approximate planted point example current code does not work yet when CubeSimpleBLMO is passed.

Test Summary: | Pass Error Total Time
Approximate planted point - Integer | 4 1 5 15.4s
Using SCIP | 2 2 11.3s
Using Cube LMO | 2 2 2.9s
Using Cube Simple LMO | 1 1 1.1s

@LeChStan
Copy link
Author

LeChStan commented Aug 31, 2024

Gradient based branching not working yet. I´m not sure why it doesn´t find the method.
image

src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
#println("\npd made\n")
if branching.decision_function == "weighted_sum"
#println(branching.decision_function)
branching_scores = map(idx-> ((1 - branching.μ) * min((pseudos[idx, 1] - 1) * (values[idx] - floor(values[idx])), (pseudos[idx, 2] - 1) * (ceil(values[idx]) - values[idx])) + branching.μ * max((pseudos[idx, 1] - 1) * (values[idx] - floor(values[idx])), (pseudos[idx, 2] - 1) * (ceil(values[idx]) - values[idx]))),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice to contract this a bit. Maybe put some things in separate functions. Currently, it is hard to read and understand what's going.

src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
src/branching_strategies.jl Outdated Show resolved Hide resolved
@dhendryc
Copy link
Collaborator

It would also be nice to have some examples and tests to check that the new branching strategies work as intended and showcase their usefulness.

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.

2 participants