@@ -138,14 +138,14 @@ Notably, you can access, and modify, the following:
138138 - `stats.solver_specific[:smooth_obj]`: current value of the smooth part of the objective function;
139139 - `stats.solver_specific[:nonsmooth_obj]`: current value of the nonsmooth part of the objective function.
140140"""
141- mutable struct ALSolver{T, V, M, ST} <: AbstractOptimizationSolver
141+ mutable struct ALSolver{T, V, M, Pb, ST} <: AbstractOptimizationSolver
142142 x:: V
143143 cx:: V
144144 y:: V
145145 has_bnds:: Bool
146- sub_model :: AugLagModel{M, T, V}
146+ sub_problem :: Pb
147147 sub_solver:: ST
148- sub_stats:: GenericExecutionStats{T, V, V, Any }
148+ sub_stats:: GenericExecutionStats{T, V, V, T }
149149end
150150
151151function ALSolver (reg_nlp:: AbstractRegularizedNLPModel{T, V} ; kwargs... ) where {T, V}
@@ -156,11 +156,12 @@ function ALSolver(reg_nlp::AbstractRegularizedNLPModel{T, V}; kwargs...) where {
156156 y = V (undef, ncon)
157157 has_bnds = has_bounds (nlp)
158158 sub_model = AugLagModel (nlp, V (undef, ncon), T (0 ), x, T (0 ), V (undef, ncon))
159+ sub_problem = RegularizedNLPModel (sub_model, reg_nlp. h,reg_nlp. selected)
159160 sub_solver = R2Solver (reg_nlp; kwargs... )
160- sub_stats = GenericExecutionStats (sub_model )
161+ sub_stats = RegularizedExecutionStats (sub_problem )
161162 M = typeof (nlp)
162163 ST = typeof (sub_solver)
163- return ALSolver {T, V, M, ST} (x, cx, y, has_bnds, sub_model , sub_solver, sub_stats)
164+ return ALSolver {T, V, M, typeof(sub_problem), ST} (x, cx, y, has_bnds, sub_problem , sub_solver, sub_stats)
164165end
165166
166167@doc (@doc ALSolver) function AL (:: Val{:equ} , reg_nlp:: AbstractRegularizedNLPModel ; kwargs... )
@@ -182,7 +183,7 @@ function SolverCore.solve!(
182183 model:: AbstractRegularizedNLPModel ;
183184 kwargs... ,
184185)
185- stats = GenericExecutionStats (model . model)
186+ stats = RegularizedExecutionStats ( model)
186187 solve! (solver, model, stats; kwargs... )
187188end
188189
@@ -209,6 +210,7 @@ function SolverCore.solve!(
209210 factor_decrease_subtol:: T = T (1 // 4 ),
210211 dual_safeguard = project_y!,
211212) where {T, V}
213+ reset! (stats)
212214
213215 # Retrieve workspace
214216 nlp = reg_nlp. model
@@ -254,8 +256,8 @@ function SolverCore.solve!(
254256 set_solver_specific! (stats, :nonsmooth_obj , hx)
255257
256258 mu = init_penalty
257- solver. sub_model . y .= solver. y
258- update_μ! (solver. sub_model , mu)
259+ solver. sub_problem . model . y .= solver. y
260+ update_μ! (solver. sub_problem . model , mu)
259261
260262 cviol = norm (solver. cx, Inf )
261263 cviol_old = Inf
@@ -279,15 +281,13 @@ function SolverCore.solve!(
279281 iter += 1
280282
281283 # dual safeguard
282- dual_safeguard (solver. sub_model )
284+ dual_safeguard (solver. sub_problem . model )
283285
284- # AL subproblem
285- sub_reg_nlp = RegularizedNLPModel (solver. sub_model, h, selected)
286286 subtol = max (subtol, atol)
287287 reset! (subout)
288288 solve! (
289289 solver. sub_solver,
290- sub_reg_nlp ,
290+ solver . sub_problem ,
291291 subout,
292292 x = solver. x,
293293 atol = subtol,
@@ -298,7 +298,7 @@ function SolverCore.solve!(
298298 verbose = subsolver_verbose,
299299 )
300300 solver. x .= subout. solution
301- solver. cx .= solver. sub_model . cx
301+ solver. cx .= solver. sub_problem . model . cx
302302 subiters = subout. iter
303303
304304 # objective
@@ -310,8 +310,8 @@ function SolverCore.solve!(
310310 set_solver_specific! (stats, :nonsmooth_obj , hx)
311311
312312 # dual estimate
313- update_y! (solver. sub_model )
314- solver. y .= solver. sub_model . y
313+ update_y! (solver. sub_problem . model )
314+ solver. y .= solver. sub_problem . model . y
315315 set_constraint_multipliers! (stats, solver. y)
316316
317317 # stationarity measure
@@ -362,7 +362,7 @@ function SolverCore.solve!(
362362 if cviol > max (ctol, factor_primal_linear_improvement * cviol_old)
363363 mu *= factor_penalty_up
364364 end
365- update_μ! (solver. sub_model , mu)
365+ update_μ! (solver. sub_problem . model , mu)
366366 cviol_old = cviol
367367 subtol *= factor_decrease_subtol
368368 rem_eval = max_eval < 0 ? max_eval : max_eval - neval_obj (nlp)
0 commit comments