@@ -35,59 +35,81 @@ using LinearAlgebra
3535
3636 TOL = R (1e-6 )
3737
38- # Nonfast/Adaptive
39-
40- x0 = zeros (T, n)
41- x0_backup = copy (x0)
42- solver = ProximalAlgorithms. ForwardBackward (tol = TOL, adaptive = true )
43- x, it = solver (x0 = x0, f = fA_autodiff, g = g)
44- @test eltype (x) == T
45- @test norm (x - x_star, Inf ) <= 1e-4
46- @test it < 1100
47- @test x0 == x0_backup
48-
49- # Fast/Adaptive
50-
51- x0 = zeros (T, n)
52- x0_backup = copy (x0)
53- solver = ProximalAlgorithms. FastForwardBackward (tol = TOL, adaptive = true )
54- x, it = solver (x0 = x0, f = fA_autodiff, g = g)
55- @test eltype (x) == T
56- @test norm (x - x_star, Inf ) <= 1e-4
57- @test it < 500
58- @test x0 == x0_backup
38+ @testset " ForwardBackward (adaptive step)" begin
39+ x0 = zeros (T, n)
40+ x0_backup = copy (x0)
41+ solver = ProximalAlgorithms. ForwardBackward (tol = TOL, adaptive = true )
42+ x, it = solver (x0 = x0, f = fA_autodiff, g = g)
43+ @test eltype (x) == T
44+ @test norm (x - x_star, Inf ) <= 1e-4
45+ @test it < 1100
46+ @test x0 == x0_backup
47+ end
5948
60- # ZeroFPR/Adaptive
49+ @testset " ForwardBackward (adaptive step, regret)" begin
50+ x0 = zeros (T, n)
51+ x0_backup = copy (x0)
52+ solver = ProximalAlgorithms. ForwardBackward (tol = TOL, adaptive = true , regret_gamma= R (1.01 ))
53+ x, it = solver (x0 = x0, f = fA_autodiff, g = g)
54+ @test eltype (x) == T
55+ @test norm (x - x_star, Inf ) <= 1e-4
56+ @test it < 500
57+ @test x0 == x0_backup
58+ end
6159
62- x0 = zeros (T, n)
63- x0_backup = copy (x0)
64- solver = ProximalAlgorithms. ZeroFPR (adaptive = true , tol = TOL)
65- x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
66- @test eltype (x) == T
67- @test norm (x - x_star, Inf ) <= 1e-4
68- @test it < 25
69- @test x0 == x0_backup
60+ @testset " FastForwardBackward (adaptive step)" begin
61+ x0 = zeros (T, n)
62+ x0_backup = copy (x0)
63+ solver = ProximalAlgorithms. FastForwardBackward (tol = TOL, adaptive = true )
64+ x, it = solver (x0 = x0, f = fA_autodiff, g = g)
65+ @test eltype (x) == T
66+ @test norm (x - x_star, Inf ) <= 1e-4
67+ @test it < 500
68+ @test x0 == x0_backup
69+ end
7070
71- # PANOC/Adaptive
71+ @testset " FastForwardBackward (adaptive step, regret)" begin
72+ x0 = zeros (T, n)
73+ x0_backup = copy (x0)
74+ solver = ProximalAlgorithms. FastForwardBackward (tol = TOL, adaptive = true , regret_gamma= R (1.01 ))
75+ x, it = solver (x0 = x0, f = fA_autodiff, g = g)
76+ @test eltype (x) == T
77+ @test norm (x - x_star, Inf ) <= 1e-4
78+ @test it < 200
79+ @test x0 == x0_backup
80+ end
7281
73- x0 = zeros (T, n)
74- x0_backup = copy (x0)
75- solver = ProximalAlgorithms. PANOC (adaptive = true , tol = TOL)
76- x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
77- @test eltype (x) == T
78- @test norm (x - x_star, Inf ) <= 1e-4
79- @test it < 50
80- @test x0 == x0_backup
82+ @testset " ZeroFPR (adaptive step)" begin
83+ x0 = zeros (T, n)
84+ x0_backup = copy (x0)
85+ solver = ProximalAlgorithms. ZeroFPR (adaptive = true , tol = TOL)
86+ x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
87+ @test eltype (x) == T
88+ @test norm (x - x_star, Inf ) <= 1e-4
89+ @test it < 25
90+ @test x0 == x0_backup
91+ end
8192
82- # PANOCplus/Adaptive
93+ @testset " PANOC (adaptive step)" begin
94+ x0 = zeros (T, n)
95+ x0_backup = copy (x0)
96+ solver = ProximalAlgorithms. PANOC (adaptive = true , tol = TOL)
97+ x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
98+ @test eltype (x) == T
99+ @test norm (x - x_star, Inf ) <= 1e-4
100+ @test it < 50
101+ @test x0 == x0_backup
102+ end
83103
84- x0 = zeros (T, n)
85- x0_backup = copy (x0)
86- solver = ProximalAlgorithms. PANOCplus (adaptive = true , tol = TOL)
87- x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
88- @test eltype (x) == T
89- @test norm (x - x_star, Inf ) <= 1e-4
90- @test it < 50
91- @test x0 == x0_backup
104+ @testset " PANOCplus (adaptive step)" begin
105+ x0 = zeros (T, n)
106+ x0_backup = copy (x0)
107+ solver = ProximalAlgorithms. PANOCplus (adaptive = true , tol = TOL)
108+ x, it = solver (x0 = x0, f = f_autodiff, A = A, g = g)
109+ @test eltype (x) == T
110+ @test norm (x - x_star, Inf ) <= 1e-4
111+ @test it < 50
112+ @test x0 == x0_backup
113+ end
92114
93115end
0 commit comments