Skip to content

Commit ce8793c

Browse files
R2,R2DH,R2N: add callback docstring
1 parent 4a755c5 commit ce8793c

File tree

3 files changed

+3
-45
lines changed

3 files changed

+3
-45
lines changed

src/R2DH.jl

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,7 @@ The algorithm stops either when `√(ξₖ/νₖ) < atol + rtol*√(ξ₀/ν₀)
134134
The value returned is a `GenericExecutionStats`, see `SolverCore.jl`.
135135
136136
# Callback
137-
The callback is called at each iteration.
138-
The expected signature of the callback is `callback(nlp, solver, stats)`, and its output is ignored.
139-
Changing any of the input arguments will affect the subsequent iterations.
140-
In particular, setting `stats.status = :user` will stop the algorithm.
141-
All relevant information should be available in `nlp` and `solver`.
142-
Notably, you can access, and modify, the following:
143-
- `solver.xk`: current iterate;
144-
- `solver.∇fk`: current gradient;
145-
- `stats`: structure holding the output of the algorithm (`GenericExecutionStats`), which contains, among other things:
146-
- `stats.iter`: current iteration counter;
147-
- `stats.objective`: current objective function value;
148-
- `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function;
149-
- `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function;
150-
- `stats.status`: current status of the algorithm. Should be `:unknown` unless the algorithm has attained a stopping criterion. Changing this to anything will stop the algorithm, but you should use `:user` to properly indicate the intention;
151-
- `stats.elapsed_time`: elapsed time in seconds.
137+
$(callback_docstring)
152138
"""
153139
function R2DH(
154140
nlp::AbstractDiagonalQNModel{T, V},

src/R2N.jl

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,7 @@ The algorithm stops either when `√(ξₖ/νₖ) < atol + rtol*√(ξ₀/ν₀)
142142
The value returned is a `GenericExecutionStats`, see `SolverCore.jl`.
143143
144144
# Callback
145-
The callback is called at each iteration.
146-
The expected signature of the callback is `callback(nlp, solver, stats)`, and its output is ignored.
147-
Changing any of the input arguments will affect the subsequent iterations.
148-
In particular, setting `stats.status = :user` will stop the algorithm.
149-
All relevant information should be available in `nlp` and `solver`.
150-
Notably, you can access, and modify, the following:
151-
- `solver.xk`: current iterate;
152-
- `solver.∇fk`: current gradient;
153-
- `stats`: structure holding the output of the algorithm (`GenericExecutionStats`), which contains, among other things:
154-
- `stats.iter`: current iteration counter;
155-
- `stats.objective`: current objective function value;
156-
- `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function;
157-
- `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function;
158-
- `stats.status`: current status of the algorithm. Should be `:unknown` unless the algorithm has attained a stopping criterion. Changing this to anything other than `:unknown` will stop the algorithm, but you should use `:user` to properly indicate the intention;
159-
- `stats.elapsed_time`: elapsed time in seconds.
145+
$(callback_docstring)
160146
Similarly to the callback, when using a quasi-Newton approximation, two functions, `qn_update_y!(nlp, solver, stats)` and `qn_copy!(nlp, solver, stats)` are called at each update of the approximation.
161147
Namely, the former computes the `y` vector for which the pair `(s, y)` is pushed into the approximation.
162148
By default, `y := ∇fk⁻ - ∇fk`.

src/R2_alg.jl

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,7 @@ The algorithm stops either when `√(ξₖ/νₖ) < atol + rtol*√(ξ₀/ν₀)
160160
The value returned is a `GenericExecutionStats`, see `SolverCore.jl`.
161161
162162
# Callback
163-
The callback is called at each iteration.
164-
The expected signature of the callback is `callback(nlp, solver, stats)`, and its output is ignored.
165-
Changing any of the input arguments will affect the subsequent iterations.
166-
In particular, setting `stats.status = :user` will stop the algorithm.
167-
All relevant information should be available in `nlp` and `solver`.
168-
Notably, you can access, and modify, the following:
169-
- `solver.xk`: current iterate;
170-
- `solver.∇fk`: current gradient;
171-
- `stats`: structure holding the output of the algorithm (`GenericExecutionStats`), which contains, among other things:
172-
- `stats.iter`: current iteration counter;
173-
- `stats.objective`: current objective function value;
174-
- `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function
175-
- `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function
176-
- `stats.status`: current status of the algorithm. Should be `:unknown` unless the algorithm has attained a stopping criterion. Changing this to anything will stop the algorithm, but you should use `:user` to properly indicate the intention.
177-
- `stats.elapsed_time`: elapsed time in seconds.
163+
$(callback_docstring)
178164
"""
179165
function R2(
180166
nlp::AbstractNLPModel{R, V},

0 commit comments

Comments
 (0)