-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdo_all_tests.m
105 lines (101 loc) · 3.44 KB
/
do_all_tests.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
104
function do_all_tests(whichsize, testparams)
% This function tests all optimizers on eight standard problems for
% several sizes and parameter ranges. The results are printed in the
% command window and saved to a file.
% Arguments
% whichsize should be set to either 'quick' (smaller sized
% problems; should run in a few minutes on a modern laptop) or 'full'
% (larger sized problems that take several hours to complete).
% testparams is logical (either true or false) and indicates whether
% fuller tests exercising all parameters of C+AG should be tried.
% Default value is true if whichsize is 'quick' and false otherwise.
assert(strcmp(whichsize,'quick') || strcmp(whichsize,'full'))
quick = strcmp(whichsize,'quick');
if nargin < 2
if quick
testparams = true;
else
testparams = false;
end
end
outfilename = [whichsize,'tests1a.out'];
outfile = fopen(outfilename, 'w');
fclose(outfile);
% The following values are used for all test runs
if quick
maxfg = 100000;
else
maxfg = 1000000;
end
algs = {
struct('method', '+', 'useL', false, ...
'params', struct( 'maxfg', maxfg, 'use_elab_progr', false))
struct('method', '+', 'useL', false, ...
'params', struct('maxfg', maxfg, 'use_elab_progr', true))
struct('method', '+', 'useL', true, ...
'params', struct('maxfg', maxfg, 'use_elab_progr', false))
struct('method', '+', 'useL', true, ...
'params', struct('maxfg', maxfg, 'use_elab_progr', true))
struct('method', '+', 'useL', false, ...
'params', struct( 'maxfg', maxfg, 'use_elab_progr', false, ...
'bp_c1', 0.2, 'bp_c2', 0.8, 'bp_c3', 1.2))
struct('method', 'a', 'useL', true, ...
'params', struct('maxfg', maxfg))
struct('method', 'a', 'useL', false, ...
'params', struct('maxfg', maxfg))
struct('method', 'c', 'useL', false, ...
'params', struct())
};
if quick
n1 = 64;
n2 = 200;
n3 = 1000;
else
n1 = 65536;
n2 = 6000;
n3 = 10000;
end
if ~testparams
algs = algs([1,6,7,8]);
end
for probnum = 1 : 9
if probnum == 1
gtol = 1e-8;
whichprob = struct('family', 'q', 'n', 1000);
elseif probnum == 2
gtol = 1e-8;
whichprob = struct('family', 'b', 'n', n1, 'lambda', 1e-3, ...
'delta', 1e-4);
elseif probnum == 3
gtol = 1e-8;
whichprob = struct('family', 'b', 'n', n1, 'lambda', 1e-3, ...
'delta', 5e-6);
elseif probnum == 4
gtol = 1e-8;
whichprob = struct('family', 'b', 'n', n1*4, 'lambda', 1e-3, ...
'delta', 1e-4);
elseif probnum == 5
gtol = 1e-8;
whichprob = struct('family', 'b', 'n', n1*4, 'lambda', 1e-3, ...
'delta', 5e-6);
elseif probnum == 6
gtol = 1e-8;
whichprob = struct('family', 'L', 'n', n2, 'lambda', 1e-4, ...
'meandist', 1, 'sigma', .4);
elseif probnum == 7
gtol = 1e-8;
whichprob = struct('family', 'L', 'n', n2, 'lambda', 5e-6, ...
'meandist', 1, 'sigma', .4);
elseif probnum == 8
gtol = 1e-6;
whichprob = struct('family', 'u', 'n', n3, 'tau', 250);
elseif probnum == 9
gtol = 1e-6;
whichprob = struct('family', 'u', 'n', n3, 'tau', 1000);
end
[handles, whichtest_str, ~, postprocess] = ...
set_up_standard_problem(whichprob);
do_one_problem_all_algs(handles, whichtest_str, gtol, algs, ...
postprocess, outfilename);
end
end