@@ -40,8 +40,33 @@ returns a state.
4040By default this method continues to call [`solve!`](@ref).
4141"""
4242function solve (problem:: Problem , algorithm:: Algorithm ; kwargs... )
43+ # obtain logger once to minimize overhead from accessing ScopedValue
44+ # additionally handle logging initialization to enable stateful LoggingAction
45+ logger = algorithm_logger ()
46+ # initialize_logger(logger, problem, algorithm, state)
47+
48+ # initialize the state and emit message
4349 state = initialize_state (problem, algorithm; kwargs... )
44- return solve! (problem, algorithm, state; kwargs... )
50+ emit_message (logger, problem, algorithm, state, :Start )
51+
52+ # main body of the algorithm
53+ while ! is_finished! (problem, algorithm, state)
54+ # logging event between convergence check and algorithm step
55+ emit_message (logger, problem, algorithm, state, :PreStep )
56+
57+ # algorithm step
58+ increment! (state)
59+ step! (problem, algorithm, state)
60+
61+ # logging event between algorithm step and convergence check
62+ emit_message (logger, problem, algorithm, state, :PostStep )
63+ end
64+
65+ # emit message about finished state
66+ output = finalize_state! (problem, algorithm, state)
67+ emit_message (logger, problem, algorithm, state, :Stop )
68+
69+ return output
4570end
4671
4772@doc """
0 commit comments