-
Notifications
You must be signed in to change notification settings - Fork 2
/
PESTO_GradientToDistance.m
56 lines (44 loc) · 1.6 KB
/
PESTO_GradientToDistance.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
clear all; clc;
% In this example, we use a proximal gradient method for
% solving the composite convex minimization problem
% min_x F(x)=f_1(x)+f_2(x);
% for notational convenience we denote xs=argmin_x F(x);
% where f_1(x) is L-smooth and mu-strongly convex and where f_2(x) is
% convex.
%
% We show how to compute the worst-case value of ||xN-xs||^2 when xN is
% obtained by doing N steps of the method starting with an initial
% iterate satisfying ||gradF(x_0)||<=1.
% (0) Initialize an empty PEP
P=pep();
% (1) Set up the objective function
paramf1.mu=0.1; % Strong convexity parameter
paramf1.L=1; % Smoothness parameter
f1=P.DeclareFunction('SmoothStronglyConvex',paramf1);
f2=P.DeclareFunction('Convex');
F=f1+f2; % F is the objective function
% (2) Set up the starting point and initial condition
x0=P.StartingPoint(); % x0 is some starting point
[xs,fs]=F.OptimalPoint(); % xs is an optimal point, and fs=F(xs)
G0=F.gradient(x0);
P.InitialCondition(G0^2<=1); % Add an initial condition ||gradF(x_0)||<=1
% (3) Algorithm
gam=.2/(paramf1.L+paramf1.mu); % step size
N=1; % number of iterations
x=x0;
for i=1:N
xint=gradient_step(x,f1,gam);
x=proximal_step(xint,f2,gam);
s=(xint-x)/gam;
end
xN=x;
% (4) Set up the performance measure
% obj=(f1.gradient(xN)+s)^2;
P.PerformanceMetric((xN-xs)^2);
% (5) Solve the PEP
P.solve(1);
% (6) Evaluate the output
% Result should be [PESTO_numerical_result | result_from_the_work]
kappa=paramf1.mu/paramf1.L;
rhosq=max((1-gam*paramf1.L)^2,(1-gam*paramf1.mu)^2);
[double((xN-xs)^2) 1/paramf1.mu^2*rhosq^(N)*double(G0^2)]