-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlp_test_loop.m
103 lines (84 loc) · 2.95 KB
/
lp_test_loop.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
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
%lp_test_loop.m
%
% requires 'test = struct('Method',{},...
% 'krylov_method',{},...
% 'precond_method',{},...
% 'inner_tol',{},...
% 'PDConvergenceDescrptions',{},...
% 'descriptions',{});'
% and 'problem' (from netlib) structures to be defined
% together with scalars length_problem, max_sigma, no_solvers
for i = first_prob:first_prob + length_problem - 1
%!!!!!!!!!!!!!!!!!!!!!!!!!!%
%! Loop over the problems !%
%!!!!!!!!!!!!!!!!!!!!!!!!!!%
probstring = ['/numerical/trees/matrices/netlib_problems/',problem{i}];
% load(problem{i});
load(probstring);
lp_setup;
options.mu0 = 0e-0; % An absolute value
options.wait = 0;
options.MaxIter = 80;
options.gamma = 1e-16;
options.FeaTol = 1e-7;
options.OptTol = 1e-7;
options.LSMRMaxIter = 100;
if exist('CalculateError')
options.CalculateError = CalculateError;
end
if exist('ScaleTol')
options.ScaleTol = ScaleTol;
end
gamma = 0.0;
delta = 0.0;
for j = 1:no_solvers
%!!!!!!!!!!!!!!!!!!!!!!!!!!%
%! Loop over the solvers !%
%!!!!!!!!!!!!!!!!!!!!!!!!!!%
fprintf('\n\n')
fprintf('###################\n')
fprintf(['## ',problem{i},'\n'])
fprintf('###################\n')
d1 = gamma; % Can be scalar if D1 = d1*I.
d2 = delta*ones(m,1);
options.Method = test(j).Method;
options.krylov_method = test(j).krylov_method;
options.precond_method = test(j).precond_method;
options.LSMRatol1 = test(j).inner_tol;
options.LSMRatol2 = test(j).inner_tol;
d1 = gamma; % Can be scalar if D1 = d1*I.
d2 = delta*ones(m,1);
[x,y,z,inform,PDitns{j,i},CGitns{j,i},time{j,i},iv,extras{j,i}] = ...
pdco(c,A,b,bl,bu,d1,d2,options,x0, ...
y0,z0,xsize,zsize );
if (sum(isnan(x)) + sum(isnan(y)) + sum(isnan(z)))
% NaN in one of the solutions....something's gone wrong!
inform = 100;
end
if (j == 1) && (inform ~= 0)
fprintf('move along...didn''t work with backslash\n')
for j = 1:no_solvers
itvec{j,i} = 0;
PDitns{j,i} = 0;
CGitns{j,i} = 0;
time{j,i} = 0;
end
lp_post;
break
elseif inform ~= 0
itvec{j,i} = 0;
PDitns{j,i} = 0;
CGitns{j,i} = 0;
time{j,i} = 0;
lp_post;
continue
end
itvec{j,i} = iv(1:PDitns{j,i});
lp_post;
end
end
lp_runs_writetable;
plot_convergence(no_solvers,extras,test,first_prob,[imgname,'ip_'])
if options.CalculateError
plot_inner_convergence(no_solvers,extras,test,first_prob,[imgname,'err_'])
end