Skip to content

Commit 10b8298

Browse files
apply suggestions for sigma in R2N & R2DH + reformat some doc
1 parent 069b854 commit 10b8298

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

src/R2DH.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,17 @@ Notably, you can access, and modify, the following:
145145
- `stats`: structure holding the output of the algorithm (`GenericExecutionStats`), which contains, among other things:
146146
- `stats.iter`: current iteration counter;
147147
- `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.
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;
151151
- `stats.elapsed_time`: elapsed time in seconds.
152152
"""
153-
function R2DH(nlp::AbstractDiagonalQNModel{T, V}, h, options::ROSolverOptions{T}; kwargs...) where {T, V}
153+
function R2DH(
154+
nlp::AbstractDiagonalQNModel{T, V},
155+
h,
156+
options::ROSolverOptions{T};
157+
kwargs...,
158+
) where {T, V}
154159
kwargs_dict = Dict(kwargs...)
155160
selected = pop!(kwargs_dict, :selected, 1:(nlp.meta.nvar))
156161
x0 = pop!(kwargs_dict, :x0, nlp.meta.x0)
@@ -164,6 +169,7 @@ function R2DH(nlp::AbstractDiagonalQNModel{T, V}, h, options::ROSolverOptions{T}
164169
verbose = options.verbose,
165170
max_iter = options.maxIter,
166171
max_time = options.maxTime,
172+
σk = options.σk,
167173
σmin = options.σmin,
168174
η1 = options.η1,
169175
η2 = options.η2,

src/R2N.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,19 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
119119
- `x::V = nlp.meta.x0`: the initial guess;
120120
- `atol::T = √eps(T)`: absolute tolerance;
121121
- `rtol::T = √eps(T)`: relative tolerance;
122-
- `neg_tol::T = eps(T)^(1 / 4)`: negative tolerance
122+
- `neg_tol::T = eps(T)^(1 / 4)`: negative tolerance;
123123
- `max_eval::Int = -1`: maximum number of evaluation of the objective function (negative number means unlimited);
124124
- `max_time::Float64 = 30.0`: maximum time limit in seconds;
125125
- `max_iter::Int = 10000`: maximum number of iterations;
126126
- `verbose::Int = 0`: if > 0, display iteration details every `verbose` iteration;
127127
- `σmin::T = eps(T)`: minimum value of the regularization parameter;
128+
- `σk::T = eps(T)^(1 / 5)`: initial value of the regularization parameter;
128129
- `η1::T = √√eps(T)`: successful iteration threshold;
129130
- `η2::T = T(0.9)`: very successful iteration threshold;
130131
- `ν::T = eps(T)^(1 / 5)`: inverse of the initial regularization parameter: ν = 1/σ;
131-
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful.
132-
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model.
133-
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`
132+
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful;
133+
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model;
134+
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`;
134135
- `sub_kwargs::Dict{Symbol}`: a dictionary containing the keyword arguments to be sent to the subsolver. The solver will fail if invalid keyword arguments are provided to the subsolver.
135136
136137
The algorithm stops either when `√(ξₖ/νₖ) < atol + rtol*√(ξ₀/ν₀) ` or `ξₖ < 0` and `√(-ξₖ/νₖ) < neg_tol` where ξₖ := f(xₖ) + h(xₖ) - φ(sₖ; xₖ) - ψ(sₖ; xₖ), and √(ξₖ/νₖ) is a stationarity measure.
@@ -150,9 +151,9 @@ Notably, you can access, and modify, the following:
150151
- `stats`: structure holding the output of the algorithm (`GenericExecutionStats`), which contains, among other things:
151152
- `stats.iter`: current iteration counter;
152153
- `stats.objective`: current objective function value;
153-
- `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function
154-
- `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function
155-
- `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.
154+
- `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function;
155+
- `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function;
156+
- `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;
156157
- `stats.elapsed_time`: elapsed time in seconds.
157158
"""
158159
function R2N(
@@ -176,6 +177,7 @@ function R2N(
176177
max_iter = options.maxIter,
177178
max_time = options.maxTime,
178179
σmin = options.σmin,
180+
σk = options.σk,
179181
η1 = options.η1,
180182
η2 = options.η2,
181183
ν = options.ν,
@@ -208,14 +210,15 @@ function SolverCore.solve!(
208210
max_iter::Int = 10000,
209211
max_time::Float64 = 30.0,
210212
max_eval::Int = -1,
213+
σk::T = eps(T)^(1 / 5),
211214
σmin::T = eps(T),
212215
η1::T = √√eps(T),
213216
η2::T = T(0.9),
214217
ν::T = eps(T)^(1 / 5),
215218
γ::T = T(3),
216219
β::T = 1 / eps(T),
217220
θ::T = 1/(1 + eps(T)^(1 / 5)),
218-
sub_kwargs::Dict{Symbol} = Dict()
221+
sub_kwargs::Dict{Symbol} = Dict(),
219222
) where {T, V, G}
220223
reset!(stats)
221224

@@ -281,8 +284,6 @@ function SolverCore.solve!(
281284
local ξ1::T
282285
local ρk::T = zero(T)
283286

284-
σk = max(1 / ν, σmin)
285-
286287
fk = obj(nlp, xk)
287288
grad!(nlp, xk, ∇fk)
288289
∇fk⁻ .= ∇fk

0 commit comments

Comments
 (0)