You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `summary` function added to the `IterativeAlgorithm` struct. This function returns a tuple of pairs where the key is the column title. E.g.: ("" => it, , "f(xg)" => state.f_xg, ...)
- The `display` function is modified to call summary and display the result. When `it = 0` is passed, then only a table header is printed.
- When `freq` in `IterativeAlgorithm` is set to 0, then only a single line is printed after the iteration stops. The format of this line is like: "total iterations = 43, f(xg) = 3.524e-3, ..."
- `default_display` function now accepts `printfunc` optional argument. The default value is `println`, and this argument allows replacing it, e.g., with a proper logger.
@@ -88,7 +90,7 @@ will internally loop over an iterator constructed as
88
90
# Note
89
91
This constructor is not meant to be used directly: instead, algorithm-specific constructors
90
92
should be defined on top of it and exposed to the user, that set appropriate default functions
91
-
for `stop`, `solution`, `display`.
93
+
for `stop`, `solution`, `summary`, `display`.
92
94
93
95
# Arguments
94
96
* `T::Type`: iterator type to use
@@ -97,28 +99,78 @@ for `stop`, `solution`, `display`.
97
99
* `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
98
100
* `verbose::Bool`: whether the algorithm state should be displayed
99
101
* `freq::Int`: every how many iterations to display the algorithm state
100
-
* `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
102
+
* `summary::Function`: function returning a summary of the iteration state, `summary(k::Int, iter::T, state)` should return a vector of pairs `(name, value)`
103
+
* `display::Function`: display function, `display(k::Int, alg, iter::T, state)` should display a summary of the iteration state
101
104
* `kwargs...`: keyword arguments to pass on to `T` when constructing the iterator
@@ -101,11 +103,12 @@ See also: [`DavisYinIteration`](@ref), [`IterativeAlgorithm`](@ref).
101
103
# Arguments
102
104
- `maxit::Int=10_000`: maximum number of iteration
103
105
- `tol::1e-8`: tolerance for the default stopping criterion
104
-
- `stop::Function`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
105
-
- `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
106
+
- `stop::Function=(iter, state) -> default_stopping_criterion(tol, iter, state)`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
107
+
- `solution::Function=default_solution`: solution mapping, `solution(::T, state)` should return the identified solution
106
108
- `verbose::Bool=false`: whether the algorithm state should be displayed
107
-
- `freq::Int=100`: every how many iterations to display the algorithm state
108
-
- `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
109
+
- `freq::Int=100`: every how many iterations to display the algorithm state. If `freq <= 0`, only the final iteration is displayed.
110
+
- `summary::Function=default_iteration_summary`: function to generate iteration summaries, `summary(::Int, iter::T, state)` should return a summary of the iteration state
111
+
- `display::Function=default_display`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
109
112
- `kwargs...`: additional keyword arguments to pass on to the `DavisYinIteration` constructor upon call
@@ -88,11 +91,12 @@ See also: [`DouglasRachfordIteration`](@ref), [`IterativeAlgorithm`](@ref).
88
91
# Arguments
89
92
- `maxit::Int=1_000`: maximum number of iteration
90
93
- `tol::1e-8`: tolerance for the default stopping criterion
91
-
- `stop::Function`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
92
-
- `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
94
+
- `stop::Function=(iter, state) -> default_stopping_criterion(tol, iter, state)`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
95
+
- `solution::Function=default_solution`: solution mapping, `solution(::T, state)` should return the identified solution
93
96
- `verbose::Bool=false`: whether the algorithm state should be displayed
94
-
- `freq::Int=100`: every how many iterations to display the algorithm state
95
-
- `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
97
+
- `freq::Int=100`: every how many iterations to display the algorithm state. If `freq <= 0`, only the final iteration is displayed.
98
+
- `summary::Function=default_iteration_summary`: function to generate iteration summaries, `summary(::Int, iter::T, state)` should return a summary of the iteration state
99
+
- `display::Function=default_display`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
96
100
- `kwargs...`: additional keyword arguments to pass on to the `DouglasRachfordIteration` constructor upon call
@@ -224,11 +224,12 @@ See also: [`DRLSIteration`](@ref), [`IterativeAlgorithm`](@ref).
224
224
# Arguments
225
225
- `maxit::Int=1_000`: maximum number of iteration
226
226
- `tol::1e-8`: tolerance for the default stopping criterion
227
-
- `stop::Function`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
228
-
- `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
227
+
- `stop::Function=(iter, state) -> default_stopping_criterion(tol, iter, state)`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
228
+
- `solution::Function=default_solution`: solution mapping, `solution(::T, state)` should return the identified solution
229
229
- `verbose::Bool=false`: whether the algorithm state should be displayed
230
-
- `freq::Int=10`: every how many iterations to display the algorithm state
231
-
- `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
230
+
- `freq::Int=10`: every how many iterations to display the algorithm state. If `freq <= 0`, only the final iteration is displayed.
231
+
- `summary::Function=default_iteration_summary`: function to generate iteration summaries, `summary(::Int, iter::T, state)` should return a summary of the iteration state
232
+
- `display::Function=default_display`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
232
233
- `kwargs...`: additional keyword arguments to pass on to the `DRLSIteration` constructor upon call
@@ -172,11 +177,12 @@ See also: [`FastForwardBackwardIteration`](@ref), [`IterativeAlgorithm`](@ref).
172
177
# Arguments
173
178
- `maxit::Int=10_000`: maximum number of iteration
174
179
- `tol::1e-8`: tolerance for the default stopping criterion
175
-
- `stop::Function`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
176
-
- `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
180
+
- `stop::Function=(iter, state) -> default_stopping_criterion(tol, iter, state)`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
181
+
- `solution::Function=default_solution`: solution mapping, `solution(::T, state)` should return the identified solution
177
182
- `verbose::Bool=false`: whether the algorithm state should be displayed
178
-
- `freq::Int=100`: every how many iterations to display the algorithm state
179
-
- `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
183
+
- `freq::Int=100`: every how many iterations to display the algorithm state. If `freq <= 0`, only the final iteration is displayed.
184
+
- `summary::Function=default_iteration_summary`: function to generate iteration summaries, `summary(::Int, iter::T, state)` should return a summary of the iteration state
185
+
- `display::Function=default_display`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
180
186
- `kwargs...`: additional keyword arguments to pass on to the `FastForwardBackwardIteration` constructor upon call
0 commit comments