Skip to content

Commit

Permalink
Add heuristic interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrych committed Nov 15, 2023
1 parent e22b273 commit 99429a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/heuristics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,23 @@

## Have a general interface for heuristics
## so that the user can link in custom heuristics.
"""
Boscia Heuristic
Interface for heuristics in Boscia.
`h` is the heuristic function receiving as input ..
`prob` is the probability with which it will be called.
"""
# Would 'Heuristic' also suffice? Or might we run into Identifer conflicts with other packages?
struct BosciaHeuristic
h::Function
prob::Float64
end

BosciaHeuristic() = BosciaHeuristic(x -> nothing, 0.0)

"""
Chooses heuristic by rolling a dice.
"""
function pick_heuristic(heuristic_list)
end

Check warning on line 24 in src/heuristics.jl

View check run for this annotation

Codecov / codecov/patch

src/heuristics.jl#L23-L24

Added lines #L23 - L24 were not covered by tests
3 changes: 3 additions & 0 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fw_verbose - if true, FrankWolfe logs are printed
use_shadow_set - The shadow set is the set of discarded vertices which is inherited by the children nodes.
It is used to avoid recomputing of vertices in case the LMO is expensive. In case of a cheap LMO,
performance might improve by disabling this option.
heuristic - Custom heuristic from the user.
"""
function solve(
f,
Expand Down Expand Up @@ -84,6 +85,7 @@ function solve(
start_solution=nothing,
fw_verbose=false,
use_shadow_set=true,
heuristic=BosciaHeuristic(),
kwargs...,
)
if verbose
Expand Down Expand Up @@ -189,6 +191,7 @@ function solve(
:usePostsolve => use_postsolve,
:variant => variant,
:use_shadow_set => use_shadow_set,
:heurtics => [heuristic], # Is a vector/list sufficent or would a dictonary be better?
),
),
branch_strategy=branching_strategy,
Expand Down

0 comments on commit 99429a0

Please sign in to comment.