Skip to content

Commit

Permalink
Lazification as an user setting (#137)
Browse files Browse the repository at this point in the history
Lazification and lazification tolerance  as a user setting and restructure evaluate node.
  • Loading branch information
dhendryc authored Aug 1, 2023
1 parent 6bea787 commit 503995d
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 117 deletions.
9 changes: 8 additions & 1 deletion src/frank_wolfe_variants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function solve_frank_wolfe(
extra_vertex_storage=nothing,
callback=nothing,
lazy=false,
lazy_tolerance=2.0,
timeout=Inf,
verbose=false,
workspace=nothing
Expand All @@ -62,7 +63,8 @@ function solve_frank_wolfe(
max_iteration=max_iteration,
line_search=line_search,
callback=callback,
lazy=lazy,
lazy=lazy,
lazy_tolerance=lazy_tolerance,
timeout=timeout,
add_dropped_vertices=add_dropped_vertices,
use_extra_vertex_storage=use_extra_vertex_storage,
Expand Down Expand Up @@ -95,6 +97,7 @@ function solve_frank_wolfe(
extra_vertex_storage=nothing,
callback=nothing,
lazy=false,
lazy_tolerance=2.0,
timeout=Inf,
verbose=false,
workspace=nothing
Expand All @@ -113,6 +116,7 @@ function solve_frank_wolfe(
callback=callback,
timeout=timeout,
verbose=verbose,
lazy_tolerance=lazy_tolerance,
)

return x, primal, dual_gap, active_set
Expand All @@ -139,6 +143,7 @@ function solve_frank_wolfe(
extra_vertex_storage=nothing,
callback=nothing,
lazy=false,
lazy_tolerance=2.0,
timeout=Inf,
verbose=false,
workspace=nothing
Expand All @@ -156,6 +161,7 @@ function solve_frank_wolfe(
extra_vertex_storage=extra_vertex_storage,
callback=callback,
lazy=lazy,
lazy_tolerance=lazy_tolerance,
timeout=timeout,
verbose=verbose
)
Expand Down Expand Up @@ -188,6 +194,7 @@ function solve_frank_wolfe(
extra_vertex_storage=nothing,
callback=nothing,
lazy=false,
lazy_tolerance=2.0,
timeout=Inf,
verbose=false,
workspace=nothing
Expand Down
33 changes: 23 additions & 10 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ variant - variant of FrankWolfe to be used to solve the node prob
AFW -- Away FrankWolfe
BPCG -- Blended Pairwise Conditional Gradient
line_search - specifies the Line Search method used in the FrankWolfe variant.
Default is the Adaptive Line Search. For other types, check the FrankWolfe.jl package.
Default is the Adaptive Line Search. For other types, check the FrankWolfe.jl package.
active_set - can be used to specify a starting point, e.g. if the feasible region is not completely
contained in the domain of the objective. By default, the direction (1,..,n) where n is
the size of the problem is used to find a start vertex. Beware that the active set may
only contain actual vertices of the feasible region.
lazy - specifies whether the lazification shoud be used. Per default true.
Beware that it has no effect with Vanilla Frank-Wolfe.
lazy_tolerance - decides how much progress is deemed enough to not have to call the LMO.
fw_epsilon - the tolerance for FrankWolfe in the root node.
verbose - if true, a log and solution statistics are printed.
dual_gap - if this absolute dual gap is reached, the algorithm stops.
Expand Down Expand Up @@ -49,6 +56,8 @@ function solve(
variant::FrankWolfeVariant=BPCG(),
line_search::FrankWolfe.LineSearchMethod=FrankWolfe.Adaptive(),
active_set::Union{Nothing, FrankWolfe.ActiveSet} = nothing,
lazy=true,
lazy_tolerance = 2.0,
fw_epsilon=1e-2,
verbose=false,
dual_gap=1e-6,
Expand Down Expand Up @@ -78,6 +87,8 @@ function solve(
println("\t Branching strategy: ", _value_to_print(branching_strategy))
println("\t FrankWolfe variant: $(variant)")
println("\t Line Search Method: $(line_search)")
println("\t Lazification: $(lazy)")
lazy ? println("\t Lazification Tolerance: $(lazy_tolerance)") : nothing
@printf("\t Absolute dual gap tolerance: %e\n", dual_gap)
@printf("\t Relative dual gap tolerance: %e\n", rel_dual_gap)
@printf("\t Frank-Wolfe subproblem tolerance: %e\n", fw_epsilon)
Expand Down Expand Up @@ -201,20 +212,22 @@ function solve(
),
global_tightenings = IntegerBounds(),
options=Dict{Symbol,Any}(
:dual_gap_decay_factor => dual_gap_decay_factor,
:domain_oracle => domain_oracle,
:dual_gap => dual_gap,
:print_iter => print_iter,
:max_fw_iter => max_fw_iter,
:min_node_fw_epsilon => min_node_fw_epsilon,
:time_limit => time_limit,
:dual_gap_decay_factor => dual_gap_decay_factor,
:dual_tightening => dual_tightening,
:fwVerbose => fw_verbose,
:global_dual_tightening => global_dual_tightening,
:strong_convexity => strong_convexity,
:variant => variant,
:lazy => lazy,
:lazy_tolerance => lazy_tolerance,
:lineSearch => line_search,
:domain_oracle => domain_oracle,
:min_node_fw_epsilon => min_node_fw_epsilon,
:max_fw_iter => max_fw_iter,
:print_iter => print_iter,
:strong_convexity => strong_convexity,
:time_limit => time_limit,
:usePostsolve => use_postsolve,
:fwVerbose => fw_verbose,
:variant => variant,
),
),
branch_strategy=branching_strategy,
Expand Down
Loading

0 comments on commit 503995d

Please sign in to comment.