@@ -66,30 +66,68 @@ for (h, h_name) ∈ ((NormL0(λ), "l0"), (NormL1(λ), "l1"))
6666 @test h (out. solution) == out. solver_specific[:Hhist ][end ]
6767 @test out. status == :first_order
6868 end
69- @testset " bpdn-with-bounds-ls-$(solver_name) -$(h_name) -TRDH" begin
70- x0 = zeros (bpdn_nls2. meta. nvar)
71- args = solver_sym == :LM ? () : (NormLinf (1.0 ),)
72- @test has_bounds (bpdn_nls2)
73- out = solver (
74- bpdn_nls2,
75- h,
76- args... ,
77- options,
78- x0 = x0,
79- subsolver = TRDH,
80- subsolver_options = subsolver_options,
81- )
82- @test typeof (out. solution) == typeof (bpdn_nls2. meta. x0)
83- @test length (out. solution) == bpdn_nls2. meta. nvar
84- @test typeof (out. solver_specific[:Fhist ]) == typeof (out. solution)
85- @test typeof (out. solver_specific[:Hhist ]) == typeof (out. solution)
86- @test typeof (out. solver_specific[:SubsolverCounter ]) == Array{Int, 1 }
87- @test typeof (out. dual_feas) == eltype (out. solution)
88- @test length (out. solver_specific[:Fhist ]) == length (out. solver_specific[:Hhist ])
89- @test length (out. solver_specific[:Fhist ]) == length (out. solver_specific[:SubsolverCounter ])
90- @test obj (bpdn_nls2, out. solution) == out. solver_specific[:Fhist ][end ]
91- @test h (out. solution) == out. solver_specific[:Hhist ][end ]
92- @test out. status == :first_order
93- end
69+ end
70+ end
71+
72+ # LMTR with TRDH as subsolver
73+ for (h, h_name) ∈ ((NormL0 (λ), " l0" ), (NormL1 (λ), " l1" ))
74+ @testset " bpdn-with-bounds-ls-LMTR-$(h_name) -TRDH" begin
75+ x0 = zeros (bpdn_nls2. meta. nvar)
76+ @test has_bounds (bpdn_nls2)
77+ LMTR_out = LMTR (
78+ bpdn_nls2,
79+ h,
80+ NormLinf (1.0 ),
81+ options,
82+ x0 = x0,
83+ subsolver = TRDH,
84+ subsolver_options = subsolver_options,
85+ )
86+ @test typeof (LMTR_out. solution) == typeof (bpdn_nls2. meta. x0)
87+ @test length (LMTR_out. solution) == bpdn_nls2. meta. nvar
88+ @test typeof (LMTR_out. solver_specific[:Fhist ]) == typeof (LMTR_out. solution)
89+ @test typeof (LMTR_out. solver_specific[:Hhist ]) == typeof (LMTR_out. solution)
90+ @test typeof (LMTR_out. solver_specific[:SubsolverCounter ]) == Array{Int, 1 }
91+ @test typeof (LMTR_out. dual_feas) == eltype (LMTR_out. solution)
92+ @test length (LMTR_out. solver_specific[:Fhist ]) == length (LMTR_out. solver_specific[:Hhist ])
93+ @test length (LMTR_out. solver_specific[:Fhist ]) ==
94+ length (LMTR_out. solver_specific[:SubsolverCounter ])
95+ @test length (LMTR_out. solver_specific[:Fhist ]) == length (LMTR_out. solver_specific[:NLSGradHist ])
96+ @test LMTR_out. solver_specific[:NLSGradHist ][end ] ==
97+ bpdn_nls2. counters. neval_jprod_residual + bpdn_nls2. counters. neval_jtprod_residual - 1
98+ @test obj (bpdn_nls2, LMTR_out. solution) == LMTR_out. solver_specific[:Fhist ][end ]
99+ @test h (LMTR_out. solution) == LMTR_out. solver_specific[:Hhist ][end ]
100+ @test LMTR_out. status == :first_order
101+ end
102+ end
103+
104+ # LM with R2DH as subsolver
105+ for (h, h_name) ∈ ((NormL0 (λ), " l0" ), )
106+ @testset " bpdn-with-bounds-ls-LM-$(h_name) -R2DH" begin
107+ x0 = zeros (bpdn_nls2. meta. nvar)
108+ @test has_bounds (bpdn_nls2)
109+ LM_out = LM (
110+ bpdn_nls2,
111+ h,
112+ options,
113+ x0 = x0,
114+ subsolver = R2DH,
115+ subsolver_options = subsolver_options,
116+ )
117+ @test typeof (LM_out. solution) == typeof (bpdn_nls2. meta. x0)
118+ @test length (LM_out. solution) == bpdn_nls2. meta. nvar
119+ @test typeof (LM_out. solver_specific[:Fhist ]) == typeof (LM_out. solution)
120+ @test typeof (LM_out. solver_specific[:Hhist ]) == typeof (LM_out. solution)
121+ @test typeof (LM_out. solver_specific[:SubsolverCounter ]) == Array{Int, 1 }
122+ @test typeof (LM_out. dual_feas) == eltype (LM_out. solution)
123+ @test length (LM_out. solver_specific[:Fhist ]) == length (LM_out. solver_specific[:Hhist ])
124+ @test length (LM_out. solver_specific[:Fhist ]) ==
125+ length (LM_out. solver_specific[:SubsolverCounter ])
126+ @test length (LM_out. solver_specific[:Fhist ]) == length (LM_out. solver_specific[:NLSGradHist ])
127+ @test LM_out. solver_specific[:NLSGradHist ][end ] ==
128+ bpdn_nls2. counters. neval_jprod_residual + bpdn_nls2. counters. neval_jtprod_residual - 1
129+ @test obj (bpdn_nls2, LM_out. solution) == LM_out. solver_specific[:Fhist ][end ]
130+ @test h (LM_out. solution) == LM_out. solver_specific[:Hhist ][end ]
131+ @test LM_out. status == :first_order
94132 end
95133end
0 commit comments