Skip to content

Commit 57b1b40

Browse files
committed
Update Nov2019
1 parent 518fe94 commit 57b1b40

File tree

84 files changed

+3469
-1743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3469
-1743
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
clear all; clc;
2+
% In this example, we use a proximal point method for solving the
3+
% non-smooth convex minimization problem
4+
% min_x F(x); for notational convenience we denote xs=argmin_x F(x);
5+
%
6+
% We show how to compute the worst-case value of F(xN)-F(xs) when xN is
7+
% obtained by doing N steps of a proximal method starting with an initial
8+
% iterate satisfying ||x0-xs||<=1.
9+
%
10+
% Alternative interpretations:
11+
% (1) the following code compute the solution to the problem
12+
% max_{F,x0,...,xN,xs} (F(xN)-F(xs))/||x0-xs||^2
13+
% s.t. x1,...,xN are generated via the proximal point method,
14+
% F is closed, proper, and convex.
15+
% where the optimization variables are the iterates and the convex
16+
% function F.
17+
%
18+
% (2) the following code compute the smallest possible value of
19+
% C(N, step sizes) such that the inequality
20+
% F(xN)-F(xs) <= C(N, step sizes) * ||x0-xs||^2
21+
% is valid for any closed, proper and convex F and any sequence of
22+
% iterates x1,...,xN generated by the proximal point method on F.
23+
%
24+
25+
26+
% (0) Initialize an empty PEP
27+
P = pep();
28+
29+
% (1) Set up the objective function
30+
F = P.DeclareFunction('Convex'); % F is the objective function
31+
32+
% (2) Set up the starting point and initial condition
33+
x0 = P.StartingPoint(); % x0 is some starting point
34+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
35+
P.InitialCondition( (x0-xs)^2 <= 1);% Initial condition ||x0-xs||^2 <= 1
36+
37+
% (3) Algorithm
38+
N = 10; % number of iterations
39+
gam = @(k)(1); % step size (possibly a function of k)
40+
41+
x = x0;
42+
for i = 1:N
43+
x = proximal_step(x, F, gam(i));
44+
end
45+
xN = x;
46+
47+
% (4) Set up the performance measure
48+
fN = F.value(xN);
49+
P.PerformanceMetric(fN-fs);
50+
51+
% (5) Solve the PEP
52+
P.solve()
53+
54+
% (6) Evaluate the output
55+
double(fN-fs) % worst-case objective function accuracy
56+
57+
% The result should be (and is) 1/(4*\sum_{i=1}^N gam(i))
58+
% see Taylor, Adrien B., Julien M. Hendrickx, and François Glineur.
59+
% "Exact Worst-case Performance of First-order Methods for Composite
60+
% Convex Optimization.", SIAM Journal on Optimization (2017)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
clear all; clc;
2+
% In this example, we use the fast proximal point method of Guler [1] for
3+
% solving the non-smooth convex minimization problem
4+
% min_x F(x); for notational convenience we denote xs=argmin_x F(x);
5+
%
6+
% [1] O. Güler. New proximal point algorithms for convex minimization.
7+
% SIAM Journal on Optimization, 2(4):649–664, 1992.
8+
%
9+
% We show how to compute the worst-case value of F(xN)-F(xs) when xN is
10+
% obtained by doing N steps of the method starting with an initial
11+
% iterate satisfying f(x0)-f(xs)+A/2*||x0-xs||^2<=1 for some A>0.
12+
%
13+
% Alternative interpretations:
14+
% (1) the following code compute the solution to the problem
15+
% max_{F,x0,...,xN,xs} (F(xN)-F(xs))/( f(x0)-f(xs)+A/2*||x0-xs||^2 )
16+
% s.t. x1,...,xN are generated via Guler's method,
17+
% F is closed, proper, and convex.
18+
% where the optimization variables are the iterates and the convex
19+
% function F.
20+
%
21+
% (2) the following code compute the smallest possible value of
22+
% C(N, step sizes) such that the inequality
23+
% F(xN)-F(xs) <= C(N, step sizes) * ( f(x0)-f(xs)+A/2*||x0-xs||^2 )
24+
% is valid for any closed, proper and convex F and any sequence of
25+
% iterates x1,...,xN generated by Guler's method on F.
26+
%
27+
28+
29+
% (0) Initialize an empty PEP
30+
P = pep();
31+
32+
% (1) Set up the objective function
33+
F = P.DeclareFunction('Convex'); % F is the objective function
34+
35+
% (2) Set up the starting point and initial condition
36+
x0 = P.StartingPoint(); % x0 is some starting point
37+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
38+
39+
% (3) Algorithm
40+
N = 13; % number of iterations
41+
A0 = 10; % initial value of A (see paper)
42+
lambda = @(k)(k/1.1); % stepsizes (possibly function of k) (see paper)
43+
44+
A = cell(N+1,1); A{1}=A0;
45+
46+
x = x0;
47+
v = x0; % second sequence of iterates (see paper)
48+
for i = 1:N
49+
alpha = (sqrt( (A{i}*lambda(i))^2 + 4 * A{i}*lambda(i) ) - A{i}*lambda(i)) / 2;
50+
y = (1-alpha) * x + alpha * v;
51+
x = proximal_step(y, F, lambda(i));
52+
v = v + 1/alpha * (x - y);
53+
A{i+1} = (1-alpha) * A{i};
54+
end
55+
xN = x;
56+
57+
f0 = F.value(x0);
58+
P.InitialCondition( f0-fs+A{1}/2*(x0-xs)^2 <= 1); % Initial condition
59+
60+
% (4) Set up the performance measure
61+
fN = F.value(xN);
62+
P.PerformanceMetric(fN-fs);
63+
64+
% (5) Solve the PEP
65+
P.solve()
66+
67+
% (6) Evaluate the output
68+
% The result should be better than the theoretical guarantee from [1]:
69+
% f(xN)-f(xs) <= 4/A{1}/(sum_{i=1}^N sqrt(lambda(i)))^2 * ( f0-fs+A{1}/2*(x0-xs)^2 )
70+
%
71+
% comparison:
72+
accumulation = 0;
73+
for i = 1:N
74+
accumulation=accumulation+sqrt(lambda(i));
75+
end
76+
theoretical_guarantee = 4/A{1}/accumulation^2;
77+
pesto_guarantee = double(fN-fs);
78+
fprintf('Theoretical guarantee from [1]: f(xN)-f(xs)<= %6.5f * ( f0-fs+A{1}/2*(x0-xs)^2 )\n \t guarantee from pesto: f(xN)-f(xs)<= %6.5f * ( f0-fs+A{1}/2*(x0-xs)^2 )\n',theoretical_guarantee,pesto_guarantee)

Examples/SubgradientMethod.m renamed to Examples/01_Methods for unconstrained convex minimization/C_SubgradientMethod.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
% iterate satisfying ||x0-xs||<=1.
1111

1212
% (0) Initialize an empty PEP
13-
P=pep();
13+
P = pep();
1414

1515
% (1) Set up the objective function
16-
param.R=1; % 'radius'-type constraint on the subgradient norms: ||g||<=1
16+
param.R = 1; % 'radius'-type constraint on the subgradient norms: ||g||<=1
1717

1818
% F is the objective function
19-
F=P.DeclareFunction('ConvexBoundedGradient',param);
19+
F = P.DeclareFunction('ConvexBoundedGradient',param);
2020

2121
% (2) Set up the starting point and initial condition
22-
x0=P.StartingPoint(); % x0 is some starting point
23-
[xs,fs]=F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
24-
P.InitialCondition((x0-xs)^2<=1);% Add an initial condition ||x0-xs||^2<= 1
22+
x0 = P.StartingPoint(); % x0 is some starting point
23+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
24+
P.InitialCondition( (x0-xs)^2 <= 1); % Initial condition ||x0-xs||^2<= 1
2525

2626
% (3) Algorithm and (4) performance measure
27-
N=5; % number of iterations
28-
h=ones(N,1)*1/sqrt(N+1); % step sizes
27+
N = 5; % number of iterations
28+
h = @(k)(1/sqrt(N+1)); % step sizes
2929

30-
x=x0;
30+
x = x0;
3131

3232
% Note: the worst-case performance measure used in the PEP is the
3333
% min_i (PerformanceMetric_i) (i.e., the best value among all
@@ -36,24 +36,24 @@
3636

3737
% we create an array to save all function values (so that we can evaluate
3838
% them afterwards)
39-
f_saved=cell(N+1,1);
39+
f_saved = cell(N+1,1);
4040
for i=1:N
41-
[g,f]=F.oracle(x);
42-
f_saved{i}=f;
41+
[g,f] = F.oracle(x);
42+
f_saved{i} = f;
4343
P.PerformanceMetric(f-fs);
44-
x=x-h(i)*g;
44+
x = x - h(i) * g;
4545
end
4646

47-
[g,f]=F.oracle(x);
48-
f_saved{N+1}=f;
47+
[g,f] = F.oracle(x);
48+
f_saved{N+1} = f;
4949
P.PerformanceMetric(f-fs);
5050

5151
% (5) Solve the PEP
5252
P.solve()
5353

5454
% (6) Evaluate the output
5555
for i=1:N+1
56-
f_saved{i}=double(f_saved{i});
56+
f_saved{i} = double(f_saved{i});
5757
end
5858
f_saved
5959
% The result should be 1/sqrt(N+1).
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
clear all; clc;
2+
% In this example, we use a subgradient method with exact line search for
3+
% solving the non-smooth convex minimization problem
4+
% min_x F(x); for notational convenience we denote xs=argmin_x F(x);
5+
% where F(x) satisfies a Lipschitz condition; i.e., it has a bounded
6+
% gradient ||g||<=R for all g being a subgradient of F at some point.
7+
%
8+
% The method originates from:
9+
% [1] Y. Drori and A. Taylor. Efficient first-order methods for convex
10+
% minimization: a constructive approach. Mathematical Programming (2019)
11+
%
12+
% We show how to compute the worst-case value of F(xN)-F(xs) when xN is
13+
% obtained by doing N steps of the specific subgradient method starting
14+
% with an initial iterate satisfying ||x0-xs||<=1.
15+
16+
% (0) Initialize an empty PEP
17+
P = pep();
18+
19+
% (1) Set up the objective function
20+
param.R = 1; % 'radius'-type constraint on the subgradient norms: ||g||<=1
21+
22+
% F is the objective function
23+
F = P.DeclareFunction('ConvexBoundedGradient',param);
24+
25+
% (2) Set up the starting point and initial condition
26+
x0 = P.StartingPoint(); % x0 is some starting point
27+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
28+
P.InitialCondition( (x0-xs)^2 <= 1); % Initial condition ||x0-xs||^2<= 1
29+
30+
% (3) Algorithm and (4) performance measure
31+
N = 5; % number of iterations
32+
x = cell(N+1,1);
33+
g = cell(N+1,1);
34+
f = cell(N+1,1);
35+
36+
x{1} = x0;
37+
[g{1},f{1}] = F.oracle(x{1});
38+
d = g{1};
39+
for i=1:N
40+
y = i/(i+1) * x{i} + 1/(i+1) * x{1};
41+
[x{i+1}, g{i+1}, f{i+1}] = exactlinesearch_step(y,F,d);
42+
d = d + g{i+1};
43+
end
44+
45+
P.PerformanceMetric(f{N+1}-fs);
46+
47+
% (5) Solve the PEP
48+
P.solve()
49+
50+
% (6) Evaluate the output
51+
double(f{N+1}-fs)
52+
53+
% The result should be 1/sqrt(N+1), see [1].

Examples/GradientMethod.m renamed to Examples/01_Methods for unconstrained convex minimization/E_GradientMethod.m

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,44 @@
66
% We show how to compute the worst-case value of F(xN)-F(xs) when xN is
77
% obtained by doing N steps of the gradient method starting with an initial
88
% iterate satisfying ||x0-xs||<=1.
9-
9+
%
10+
% Result to be compared with that of
11+
% [1] Yoel Drori. "Contributions to the Complexity Analysis of
12+
% Optimization Algorithms." PhD thesis, Tel-Aviv University, 2014.
1013

1114
% (0) Initialize an empty PEP
12-
P=pep();
15+
P = pep();
1316

1417
% (1) Set up the objective function
15-
param.mu=0; % Strong convexity parameter
16-
param.L=1; % Smoothness parameter
18+
param.mu = 0; % Strong convexity parameter
19+
param.L = 1; % Smoothness parameter
1720

1821
F=P.DeclareFunction('SmoothStronglyConvex',param); % F is the objective function
1922

2023
% (2) Set up the starting point and initial condition
21-
x0=P.StartingPoint(); % x0 is some starting point
22-
[xs,fs]=F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
23-
P.InitialCondition((x0-xs)^2<=1); % Add an initial condition ||x0-xs||^2<= 1
24+
x0 = P.StartingPoint(); % x0 is some starting point
25+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
26+
P.InitialCondition( (x0-xs)^2 <= 1); % Initial condition ||x0-xs||^2<= 1
2427

2528
% (3) Algorithm
26-
h=1/param.L; % step size
27-
N=10; % number of iterations
28-
29-
x=x0;
30-
for i=1:N
31-
x=x-h*F.gradient(x);
32-
% % Alternate - shorter - form:
33-
% x=gradient_step(x,F,gam);
29+
h = 1/param.L; % step size
30+
N = 10; % number of iterations
31+
32+
x = x0;
33+
for i = 1:N
34+
x = x-h*F.gradient(x);
3435
end
35-
xN=x;
36+
xN = x;
3637

3738
% (4) Set up the performance measure
38-
fN=F.value(xN); % g=grad F(x), f=F(x)
39-
P.PerformanceMetric(fN-fs); % Worst-case evaluated as F(x)-F(xs)
39+
fN = F.value(xN);
40+
P.PerformanceMetric(fN-fs); % Worst-case evaluated as F(x)-F(xs)
4041

4142
% (5) Solve the PEP
4243
P.solve()
4344

4445
% (6) Evaluate the output
4546
double(fN-fs) % worst-case objective function accuracy
4647

47-
% The result should be
48+
% The result should be (see [1])
4849
% param.L/2/(2*N+1)

Examples/GradientExactLineSearch.m renamed to Examples/01_Methods for unconstrained convex minimization/F_GradientExactLineSearch.m

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,40 @@
1313
% obtained by doing N steps of the method starting with an initial
1414
% iterate satisfying F(x0)-F(xs)<=1.
1515
%
16-
% The full approach (based on convex relaxations) is available in
16+
% The detailed approach (based on convex relaxations) is available in
1717
% De Klerk, Etienne, François Glineur, and Adrien B. Taylor.
1818
% "On the worst-case complexity of the gradient method with exact
1919
% line search for smooth strongly convex functions."
20-
% Optimization Letters (2016).
20+
% Optimization Letters (2017).
2121

2222
% (0) Initialize an empty PEP
23-
P=pep();
23+
P = pep();
2424

2525
% (1) Set up the objective function
26-
param.mu=.1; % Strong convexity parameter
27-
param.L=1; % Smoothness parameter
26+
param.mu = .1; % Strong convexity parameter
27+
param.L = 1; % Smoothness parameter
2828

29-
F=P.DeclareFunction('SmoothStronglyConvex',param);
29+
F = P.DeclareFunction('SmoothStronglyConvex',param);
3030
% F is the objective function
3131

3232
% (2) Set up the starting point and initial condition
33-
x0=P.StartingPoint(); % x0 is some starting point
34-
[xs,fs]=F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
35-
[g0,f0]=F.oracle(x0);
36-
P.InitialCondition(f0-fs<=1); % Add an initial condition f0-fs<= 1
33+
x0 = P.StartingPoint(); % x0 is some starting point
34+
[xs,fs] = F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
35+
[g0,f0] = F.oracle(x0);
36+
P.InitialCondition(f0-fs<=1); % Initial condition f0-fs<= 1
3737

3838
% (3) Algorithm
3939
N = 2;
4040
x = x0;
4141
for i = 1:N
4242
g = F.gradient(x);
43+
44+
% exact line search on F from point x and in direction g:
4345
x = exactlinesearch_step(x,F,g);
4446
end
4547

4648
% (4) Set up the performance measure
47-
[g,f]=F.oracle(x);
49+
[g,f] = F.oracle(x);
4850
P.PerformanceMetric(f-fs); % Worst-case evaluated as F(x)-F(xs)
4951

5052
% (5) Solve the PEP

0 commit comments

Comments
 (0)