@@ -2,7 +2,7 @@ module AlgorithmsInterfaceExtensions
22
33import AlgorithmsInterface as AI
44
5- #= ========================= Patches for AlgorithmsInterface.jl ============================#
5+ # ========================== Patches for AlgorithmsInterface.jl ============================
66
77abstract type Problem <: AI.Problem end
88abstract type Algorithm <: AI.Algorithm end
@@ -30,7 +30,7 @@ function AI.initialize_state(
3030 return DefaultState (; stopping_criterion_state, kwargs... )
3131end
3232
33- #= =========================== DefaultState ================================================#
33+ # ============================ DefaultState ================================================
3434
3535@kwdef mutable struct DefaultState{
3636 Iterate, StoppingCriterionState <: AI.StoppingCriterionState ,
4040 stopping_criterion_state:: StoppingCriterionState
4141end
4242
43- #= =========================== increment! ==================================================#
43+ # ============================ increment! ==================================================
4444
4545# Custom version of `increment!` that also takes the problem and algorithm as arguments.
4646function AI. increment! (problem:: Problem , algorithm:: Algorithm , state:: State )
4747 return AI. increment! (state)
4848end
49-
50- #= =========================== solve! ======================================================#
49+ # ============================ solve! ======================================================
5150
5251# Custom version of `solve!` that allows specifying the logger and also overloads
5352# `increment!` on the problem and algorithm.
@@ -58,13 +57,13 @@ default_logging_context_prefix(x) = Symbol(basetypenameof(x), :_)
5857function default_logging_context_prefix (problem:: Problem , algorithm:: Algorithm )
5958 return Symbol (
6059 default_logging_context_prefix (problem),
61- default_logging_context_prefix (algorithm),
60+ default_logging_context_prefix (algorithm)
6261 )
6362end
6463function AI. solve! (
6564 problem:: Problem , algorithm:: Algorithm , state:: State ;
6665 logging_context_prefix = default_logging_context_prefix (problem, algorithm),
67- kwargs... ,
66+ kwargs...
6867 )
6968 logger = AI. algorithm_logger ()
7069
9796function AI. solve (
9897 problem:: Problem , algorithm:: Algorithm ;
9998 logging_context_prefix = default_logging_context_prefix (problem, algorithm),
100- kwargs... ,
99+ kwargs...
101100 )
102101 state = AI. initialize_state (problem, algorithm; kwargs... )
103102 return AI. solve! (problem, algorithm, state; logging_context_prefix, kwargs... )
104103end
105104
106- #= =========================== AlgorithmIterator ===========================================#
105+ # ============================ AlgorithmIterator ===========================================
107106
108107abstract type AlgorithmIterator end
109108
@@ -138,7 +137,7 @@ struct DefaultAlgorithmIterator{Problem, Algorithm, State} <: AlgorithmIterator
138137 state:: State
139138end
140139
141- #= =========================== with_algorithmlogger ========================================#
140+ # ============================ with_algorithmlogger ========================================
142141
143142# Allow passing functions, not just CallbackActions.
144143@inline function with_algorithmlogger (f, args:: Pair{Symbol, AI.LoggingAction} ...)
148147 return AI. with_algorithmlogger (f, (first .(args) .=> AI. CallbackAction .(last .(args))). .. )
149148end
150149
151- #= =========================== NestedAlgorithm =============================================#
150+ # ============================ NestedAlgorithm =============================================
152151
153152abstract type NestedAlgorithm <: Algorithm end
154153
@@ -211,7 +210,7 @@ function DefaultNestedAlgorithm(f::Function, nalgorithms::Int; kwargs...)
211210 return DefaultNestedAlgorithm (; algorithms = f .(1 : nalgorithms), kwargs... )
212211end
213212
214- #= =========================== FlattenedAlgorithm ==========================================#
213+ # ============================ FlattenedAlgorithm ==========================================
215214
216215# Flatten a nested algorithm.
217216abstract type FlattenedAlgorithm <: Algorithm end
283282 stopping_criterion_state:: StoppingCriterionState
284283end
285284
286- #= =========================== NonIterativeAlgorithm =======================================#
285+ # ============================ NonIterativeAlgorithm =======================================
287286
288287# Algorithm that only performs a single step.
289288abstract type NonIterativeAlgorithm <: Algorithm end
0 commit comments