-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.m
More file actions
66 lines (54 loc) · 1.98 KB
/
demo.m
File metadata and controls
66 lines (54 loc) · 1.98 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
% (1) worst-case of the optimized gradient method with respect to
% objective value at the best iterate, 20 iterations. Solver
% set to Mosek with tolerance 1e-10.
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='OGM2'; A.N=40;
C.name='Obj'; S.solver='mosek'; S.tol=1e-10;
S.verb=0;
[val, Sol, Prob]=pep_yalmip(P,A,C,S); format long; val
%%
% (2) worst-case of the gradient method with h=1.5 with respect to
% last gradient norm, 10 iterations. Default Yalmip solver and
% tolerance.
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='GM'; A.N=10; A.stepsize=1.5;
C.name='Grad';
[val, Sol, Prob]=pep_yalmip(P,A,C); format long; val
%%
% (3) worst-case of the fast gradient method with respect to
% best gradient norm, 5 iterations. Solver set to Sedumi
% tolerance 1e-9.
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='FGM1'; A.N=5;
C.name='MinGrad';
S.solver='sedumi'; S.tol=1e-9;
[val, Sol, Prob]=pep_yalmip(P,A,C,S); format long; val
%%
% (4) worst-case of the unit-step gradient method with respect to
% best gradient norm, 2 iterations. Solver set to Sedumi
% with tolerance 1e-9. 2 ways of doing this: via the 'Custom'
% and via the 'GM' options.
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='Custom'; A.N=2; C.name='MinGrad';
S.solver='sedumi'; S.tol=1e-9; S.verb=0;
A.stepsize=[1 0 ; 1 1];
[val, Sol, Prob]=pep_yalmip(P,A,C,S); format long; val
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='GM'; A.N=2; C.name='MinGrad';
S.solver='sedumi'; S.tol=1e-9; S.verb=0;
A.stepsize=1;
[val, Sol, Prob]=pep_yalmip(P,A,C,S); format long; val
%%
% (5) worst-case of the gradient method with h=1.5 with respect to
% objective value of the average of the iterates,
% 10 iterations. Default Yalmip solver and tolerance.
clear P A C S;
P.L=1; P.mu=0; P.R=1;
A.name='GM'; A.N=10; A.stepsize=1.5;
C.name='AvgObj';
[val, Sol, Prob]=pep_yalmip(P,A,C); format long; val