Skip to content

Commit f01f41c

Browse files
fix sub_kwargs
1 parent d6f054c commit f01f41c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/R2N.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
134134
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful;
135135
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model;
136136
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`;
137-
- `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.
137+
- `sub_kwargs::NamedTuple`: a named tuple containing the keyword arguments to be sent to the subsolver. The solver will fail if invalid keyword arguments are provided to the subsolver.
138138
139139
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.
140140
@@ -174,7 +174,7 @@ function R2N(
174174
selected = pop!(kwargs_dict, :selected, 1:(nlp.meta.nvar))
175175
x0 = pop!(kwargs_dict, :x0, nlp.meta.x0)
176176
reg_nlp = RegularizedNLPModel(nlp, h, selected)
177-
sub_kwargs = pop!(kwargs_dict, :sub_kwargs, Dict{Symbol, Any}())
177+
sub_kwargs = pop!(kwargs_dict, :sub_kwargs, NamedTuple())
178178
return R2N(
179179
reg_nlp,
180180
x = x0,
@@ -226,7 +226,7 @@ function SolverCore.solve!(
226226
γ::T = T(3),
227227
β::T = 1 / eps(T),
228228
θ::T = 1/(1 + eps(T)^(1 / 5)),
229-
sub_kwargs::Dict{Symbol} = Dict(),
229+
sub_kwargs::NamedTuple = NamedTuple(),
230230
) where {T, V, G}
231231
reset!(stats)
232232

@@ -365,11 +365,11 @@ function SolverCore.solve!(
365365
solver.subpb.model.σ = σk
366366
isa(solver.subsolver, R2DHSolver) && (solver.subsolver.D.d[1] = 1/ν₁)
367367
if isa(solver.subsolver, R2Solver) #FIXME
368-
sub_kwargs[] = ν₁
368+
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, ν = ν₁, atol = sub_atol, sub_kwargs...)
369369
else
370-
sub_kwargs[:σk] = σk
370+
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, σk = σk, atol = sub_atol, sub_kwargs...)
371371
end
372-
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, atol = sub_atol, sub_kwargs...)
372+
373373

374374
s .= solver.substats.solution
375375

0 commit comments

Comments
 (0)