Skip to content

Commit e74f64a

Browse files
remove nu in R2N & R2DH
1 parent 10b8298 commit e74f64a

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

src/R2DH.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ or
121121
- `max_iter::Int = 10000`: maximum number of iterations;
122122
- `verbose::Int = 0`: if > 0, display iteration details every `verbose` iteration;
123123
- `σmin::T = eps(T)`: minimum value of the regularization parameter;
124+
- `σk::T = eps(T)^(1 / 5)`: initial value of the regularization parameter;
124125
- `η1::T = √√eps(T)`: very successful iteration threshold;
125126
- `η2::T = T(0.9)`: successful iteration threshold;
126-
- `ν::T = eps(T)^(1 / 5)`: inverse of the initial regularization parameter: ν = 1/σ;
127127
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful.
128128
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model.
129129
- `m_monotone::Int = 6`: monotoneness parameter. By default, R2DH is non-monotone but the monotone variant can be used with `m_monotone = 1`
@@ -173,7 +173,6 @@ function R2DH(
173173
σmin = options.σmin,
174174
η1 = options.η1,
175175
η2 = options.η2,
176-
ν = options.ν,
177176
γ = options.γ,
178177
θ = options.θ,
179178
kwargs_dict...,
@@ -206,7 +205,6 @@ function R2DH(
206205
σmin = options.σmin,
207206
η1 = options.η1,
208207
η2 = options.η2,
209-
ν = options.ν,
210208
γ = options.γ,
211209
θ = options.θ,
212210
kwargs...,
@@ -242,7 +240,6 @@ function SolverCore.solve!(
242240
σmin::T = eps(T),
243241
η1::T = √√eps(T),
244242
η2::T = T(0.9),
245-
ν::T = eps(T)^(1 / 5),
246243
γ::T = T(3),
247244
θ::T = 1/(1 + eps(T)^(1 / 5)),
248245
) where {T, V}

src/R2N.jl

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
128128
- `σk::T = eps(T)^(1 / 5)`: initial value of the regularization parameter;
129129
- `η1::T = √√eps(T)`: successful iteration threshold;
130130
- `η2::T = T(0.9)`: very successful iteration threshold;
131-
- `ν::T = eps(T)^(1 / 5)`: inverse of the initial regularization parameter: ν = 1/σ;
132131
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful;
133132
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model;
134133
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`;
@@ -180,7 +179,6 @@ function R2N(
180179
σk = options.σk,
181180
η1 = options.η1,
182181
η2 = options.η2,
183-
ν = options.ν,
184182
γ = options.γ,
185183
sub_kwargs = sub_kwargs;
186184
kwargs_dict...,
@@ -214,7 +212,6 @@ function SolverCore.solve!(
214212
σmin::T = eps(T),
215213
η1::T = √√eps(T),
216214
η2::T = T(0.9),
217-
ν::T = eps(T)^(1 / 5),
218215
γ::T = T(3),
219216
β::T = 1 / eps(T),
220217
θ::T = 1/(1 + eps(T)^(1 / 5)),
@@ -355,16 +352,12 @@ function SolverCore.solve!(
355352

356353
solver.subpb.model.σ = σk
357354
isa(solver.subsolver, R2DHSolver) && (solver.subsolver.D.d[1] = 1/ν₁)
358-
sub_ν = isa(solver.subsolver, R2DHSolver) ? 1/σk : ν₁
359-
solve!(
360-
solver.subsolver,
361-
solver.subpb,
362-
solver.substats;
363-
x = s1,
364-
atol = sub_atol,
365-
ν = sub_ν,
366-
sub_kwargs...,
367-
)
355+
if isa(solver.subsolver, R2Solver) #FIXME
356+
sub_kwargs[] = ν₁
357+
else
358+
sub_kwargs[:σk] = σk
359+
end
360+
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, atol = sub_atol, sub_kwargs...)
368361

369362
s .= solver.substats.solution
370363

test/test_allocs.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ end
4848
reg_nlp = RegularizedNLPModel(LBFGSModel(bpdn), h)
4949
solver = eval(solver)(reg_nlp)
5050
stats = RegularizedExecutionStats(reg_nlp)
51-
@test @wrappedallocs(solve!(solver, reg_nlp, stats, ν = 1.0, atol = 1e-6, rtol = 1e-6)) == 0
51+
solver_name == "R2" &&
52+
@test @wrappedallocs(solve!(solver, reg_nlp, stats, ν = 1.0, atol = 1e-6, rtol = 1e-6)) ==
53+
0
54+
solver_name == "R2DH" && @test @wrappedallocs(
55+
solve!(solver, reg_nlp, stats, σk = 1.0, atol = 1e-6, rtol = 1e-6)
56+
) == 0
5257
@test stats.status == :first_order
5358
end
5459
end

0 commit comments

Comments
 (0)