@@ -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}
@@ -155,12 +155,21 @@ function ALSolver(reg_nlp::AbstractRegularizedNLPModel{T, V}; kwargs...) where {
155155 cx = V (undef, ncon)
156156 y = V (undef, ncon)
157157 has_bnds = has_bounds (nlp)
158- sub_model = AugLagModel (nlp, V (undef, ncon), T (0 ), x, T (0 ), V (undef, ncon))
158+ sub_model = AugLagModel (nlp, V (undef, ncon), T (0 ), x, T (0 ), cx)
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} (
165+ x,
166+ cx,
167+ y,
168+ has_bnds,
169+ sub_problem,
170+ sub_solver,
171+ sub_stats,
172+ )
164173end
165174
166175@doc (@doc ALSolver) function AL (:: Val{:equ} , reg_nlp:: AbstractRegularizedNLPModel ; kwargs... )
@@ -182,7 +191,7 @@ function SolverCore.solve!(
182191 model:: AbstractRegularizedNLPModel ;
183192 kwargs... ,
184193)
185- stats = GenericExecutionStats (model . model)
194+ stats = RegularizedExecutionStats ( model)
186195 solve! (solver, model, stats; kwargs... )
187196end
188197
@@ -209,6 +218,7 @@ function SolverCore.solve!(
209218 factor_decrease_subtol:: T = T (1 // 4 ),
210219 dual_safeguard = project_y!,
211220) where {T, V}
221+ reset! (stats)
212222
213223 # Retrieve workspace
214224 nlp = reg_nlp. model
@@ -254,8 +264,8 @@ function SolverCore.solve!(
254264 set_solver_specific! (stats, :nonsmooth_obj , hx)
255265
256266 mu = init_penalty
257- solver. sub_model . y .= solver. y
258- update_μ! (solver. sub_model , mu)
267+ solver. sub_problem . model . y .= solver. y
268+ update_μ! (solver. sub_problem . model , mu)
259269
260270 cviol = norm (solver. cx, Inf )
261271 cviol_old = Inf
@@ -279,15 +289,13 @@ function SolverCore.solve!(
279289 iter += 1
280290
281291 # dual safeguard
282- dual_safeguard (solver. sub_model )
292+ dual_safeguard (solver. sub_problem . model )
283293
284- # AL subproblem
285- sub_reg_nlp = RegularizedNLPModel (solver. sub_model, h, selected)
286294 subtol = max (subtol, atol)
287295 reset! (subout)
288296 solve! (
289297 solver. sub_solver,
290- sub_reg_nlp ,
298+ solver . sub_problem ,
291299 subout,
292300 x = solver. x,
293301 atol = subtol,
@@ -298,8 +306,8 @@ function SolverCore.solve!(
298306 verbose = subsolver_verbose,
299307 )
300308 solver. x .= subout. solution
301- solver. cx .= solver. sub_model . cx
302- subiters + = subout. iter
309+ solver. cx .= solver. sub_problem . model . cx
310+ subiters = subout. iter
303311
304312 # objective
305313 fx = obj (nlp, solver. x)
@@ -310,8 +318,8 @@ function SolverCore.solve!(
310318 set_solver_specific! (stats, :nonsmooth_obj , hx)
311319
312320 # dual estimate
313- update_y! (solver. sub_model )
314- solver. y .= solver. sub_model . y
321+ update_y! (solver. sub_problem . model )
322+ solver. y .= solver. sub_problem . model . y
315323 set_constraint_multipliers! (stats, solver. y)
316324
317325 # stationarity measure
@@ -362,7 +370,7 @@ function SolverCore.solve!(
362370 if cviol > max (ctol, factor_primal_linear_improvement * cviol_old)
363371 mu *= factor_penalty_up
364372 end
365- update_μ! (solver. sub_model , mu)
373+ update_μ! (solver. sub_problem . model , mu)
366374 cviol_old = cviol
367375 subtol *= factor_decrease_subtol
368376 rem_eval = max_eval < 0 ? max_eval : max_eval - neval_obj (nlp)
0 commit comments