Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AL_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function ALSolver(reg_nlp::AbstractRegularizedNLPModel{T, V}; kwargs...) where {
cx = V(undef, ncon)
y = V(undef, ncon)
has_bnds = has_bounds(nlp)
sub_model = AugLagModel(nlp, V(undef, ncon), T(0), x, T(0), V(undef, ncon))
sub_model = AugLagModel(nlp, V(undef, ncon), T(0), x, T(0), cx)
sub_problem = RegularizedNLPModel(sub_model, reg_nlp.h, reg_nlp.selected)
sub_solver = R2Solver(reg_nlp; kwargs...)
sub_stats = RegularizedExecutionStats(sub_problem)
Expand Down
12 changes: 6 additions & 6 deletions src/R2N.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful;
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model;
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`;
- `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.
- `sub_kwargs::NamedTuple = 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. For example, if the subsolver is `R2Solver`, you can pass `sub_kwargs = (max_iter = 100, σmin = 1e-6,)`.

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.

Expand Down Expand Up @@ -174,7 +174,7 @@ function R2N(
selected = pop!(kwargs_dict, :selected, 1:(nlp.meta.nvar))
x0 = pop!(kwargs_dict, :x0, nlp.meta.x0)
reg_nlp = RegularizedNLPModel(nlp, h, selected)
sub_kwargs = pop!(kwargs_dict, :sub_kwargs, Dict{Symbol, Any}())
sub_kwargs = pop!(kwargs_dict, :sub_kwargs, NamedTuple())
return R2N(
reg_nlp,
x = x0,
Expand Down Expand Up @@ -226,7 +226,7 @@ function SolverCore.solve!(
γ::T = T(3),
β::T = 1 / eps(T),
θ::T = 1/(1 + eps(T)^(1 / 5)),
sub_kwargs::Dict{Symbol} = Dict(),
sub_kwargs::NamedTuple = NamedTuple(),
) where {T, V, G}
reset!(stats)

Expand Down Expand Up @@ -365,11 +365,11 @@ function SolverCore.solve!(
solver.subpb.model.σ = σk
isa(solver.subsolver, R2DHSolver) && (solver.subsolver.D.d[1] = 1/ν₁)
if isa(solver.subsolver, R2Solver) #FIXME
sub_kwargs[:ν] = ν₁
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, ν = ν₁, atol = sub_atol, sub_kwargs...)
else
sub_kwargs[:σk] = σk
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, σk = σk, atol = sub_atol, sub_kwargs...)
end
solve!(solver.subsolver, solver.subpb, solver.substats; x = s1, atol = sub_atol, sub_kwargs...)


s .= solver.substats.solution

Expand Down
4 changes: 4 additions & 0 deletions src/TR_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ For advanced usage, first define a solver "TRSolver" to preallocate the memory u
- `γ::T = T(3)`: trust-region radius parameter multiplier. Must satisfy `γ > 1`. The trust-region radius is updated as Δ := Δ*γ when the iteration is very successful and Δ := Δ/γ when the iteration is unsuccessful;
- `χ::F = NormLinf(1)`: norm used to define the trust-region;`
- `subsolver::S = R2Solver`: subsolver used to solve the subproblem that appears at each iteration.
- `sub_kwargs::NamedTuple = 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. For example, if the subsolver is `R2Solver`, you can pass `sub_kwargs = (max_iter = 100, σmin = 1e-6,)`.

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.

Expand Down Expand Up @@ -199,6 +200,7 @@ function SolverCore.solve!(
η1::T = √√eps(T),
η2::T = T(0.9),
γ::T = T(3),
sub_kwargs::NamedTuple = NamedTuple(),
) where {T, G, V}
reset!(stats)

Expand Down Expand Up @@ -353,6 +355,7 @@ function SolverCore.solve!(
x = s,
atol = stats.iter == 0 ? 1e-5 : max(sub_atol, min(1e-2, sqrt_ξ1_νInv)),
Δk = ∆_effective / 10,
sub_kwargs...
)
else
solve!(
Expand All @@ -362,6 +365,7 @@ function SolverCore.solve!(
x = s,
atol = stats.iter == 0 ? 1e-5 : max(sub_atol, min(1e-2, sqrt_ξ1_νInv)),
ν = ν₁,
sub_kwargs...
)
end
end
Expand Down
Loading