Repository navigation
Expand file tree
/
Copy pathProxGrad.m
More file actions
136 lines (90 loc) · 2.57 KB
/
Copy pathProxGrad.m
File metadata and controls
136 lines (90 loc) · 2.57 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function [x,info,iter,nfev,ngev,time] = CondG(n,m,l,u,x,dimA,A,b)
tic;
tol = 10^(-4);
ftol = 10^(-4);
itermax = 200;
% Counters
nfev = 0;
ngev = 0;
iter = 0;
% Evaluate F
for i = 1:m
H(i) = evalh(n,x,i);
G(i) = evalg(n,x,i,A,b);
end
F = H + G;
nfev = nfev + 1;
fprintf('----------------------------------------------------------------------\n')
fprintf(' Proximal Gradient Method for Composite Multiojective Optimization \n')
fprintf('----------------------------------------------------------------------\n')
fprintf('Number of variables : %i \n',n)
fprintf('Number of objectives : %i \n',m)
fprintf('Optimality tolerance: %.0e \n\n',tol)
% -----------
% Main Loop
% -----------
while(1)
% Compute the Jacobian of H
for i = 1:m
JH(i,:) = evalgradh(n,x,i);
end
ngev = ngev + 1;
% Solve the subproblem
[theta,tau,p,flagIS] = subproblemProxGrad(n,m,l,u,x,JH,G,dimA,A,b);
% Print information
if ( mod(iter,10) == 0 )
fprintf('\n')
fprintf('%-5s %-8s %-8s%-8s \n','it','|theta|','IS','LS')
end
if ( iter == 0 )
fprintf('%5d %8.2e %-8i %-8s\n',iter,abs(theta),flagIS,'-')
else
fprintf('%5d %8.2e %-8i %-8i\n',iter,abs(theta),flagIS,flagLS)
end
% -----------
% Stopping criteria
% -----------
% Test optimality
if ( iter > 0 && norm( x - xprev, Inf ) / max(1 , norm( xprev, Inf ) ) <= tol )
if ( abs(theta) <= tol )
info = 0;
% Stop timing
time = toc;
% Print information
fprintf('\n')
fprintf('Solution was found.\n')
fprintf('Number of function evaluations: %i\n',nfev)
fprintf('Number of gradient evaluations: %i\n',ngev)
fprintf('CPU time(s) : %.1f \n',time)
return
end
end
% Test the maximum number of iterations
if ( iter >= itermax )
info = 1;
% Stop timing
time = toc;
% Print information
fprintf('\n')
fprintf('The number of maximum iterations was reached.\n')
fprintf('CPU time(s): %.1f \n',time)
return
end
% -----------
% Iterate
% -----------
iter = iter + 1;
% Define the search direction
d = p - x;
% Compute the step size
[stp,H,G,nfevLS,flagLS] = armijo(n,m,x,d,F,JH,tau,ftol,A,b);
nfev = nfev + nfevLS;
% Update x
xprev = x;
x = x + stp * d;
% Evaluate F
F = H + G;
end
% -----------
% End of Main Loop
% -----------