-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf_profile.m
91 lines (73 loc) · 2.44 KB
/
perf_profile.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
% This subroutine produces a data profile as described in:
%
% Benchmarking Derivative-Free Optimization Algorithms
% Jorge J. More' and Stefan M. Wild
% SIAM J. Optimization, Vol. 20 (1), pp.172-191, 2009.
function hl = perf_profile(H,solvers,figtitle)
[np,ns] = size(H); % Grab the dimensions
% For each problem and solver, determine the number of evaluations
% required to reach the cutoff value
T = H;
% Other colors, lines, and markers are easily possible:
colors = ['b' 'r' 'k' 'm' 'c' 'g' 'y'];
lines = {'-' '-.' '--'};
markers = ['o' 's' '^' 'p' '+' '*' 'x' 'v' '>' '<' 'd' 'h'];
%colors = ['k' 'm' 'c' 'g'];
%colors = ['b' 'r' 'g'];
%lines = {'-' '--' ':' '-.'};
%markers = ['p' 'o' '^' 's'];
% Compute ratios and divide by smallest element in each row.
r = T./repmat(min(T,[],2),1,ns);
% Replace all NaN's with twice the max_ratio and sort.
max_ratio = max(max(r));
%max_ratio = 40
%disp('perf_profile: max_ratio impostato a mano')
r(isnan(r)) = 2*max_ratio;
r = sort(r);
%ax(1) = axes('Position',[0.1 0.1 0.5 0.8]);
% Plot stair graphs with markers.
hl = zeros(ns,1);
for s = 1:ns
[xs,ys] = stairs(r(:,s),(1:np)/np);
% Only plot one marker at the intercept
if (xs(1)==1)
vv = find(xs==1,1,'last');
xs = xs(vv:end); ys = ys(vv:end);
end
sl = mod(s-1,3) + 1; sc = mod(s-1,7) + 1; sm = mod(s-1,12) + 1;
option1 = [char(lines(sl)) colors(sc) markers(sm)];
%hl(s) = semilogx(xs,ys,option1);
hl(s) = plot(xs,ys,option1);
hold on;
end
% Axis properties are set so that failures are not shown, but with the
% max_ratio data points shown. This highlights the "flatline" effect.
%axis([1 5 0 1]);
%axis([1 100 0 1]);
axis([1 max_ratio 0 1]);
legend(solvers,'Location','SouthEast');
xlabel('performance ratio, \alpha');
ylabel('percentage of problems');
title(figtitle);
xmed = 5;
if 0
ax(2) = axes('Position',[0.7 0.1 0.2 0.8]);
for s = 1:ns
[xs,ys] = stairs(r(:,s),(1:np)/np);
% Only plot one marker at the intercept
%if (xs(1)==5)
vv = find(xs>=xmed,1,'first');
xs = xs(vv:end); ys = ys(vv:end);
%end
sl = mod(s-1,3) + 1; sc = mod(s-1,7) + 1; sm = mod(s-1,12) + 1;
option1 = [char(lines(sl)) colors(sc) markers(sm)];
hl(s) = plot(xs,ys,option1);
hold on;
end
axis([xmed max_ratio 0 1]);
%ax(2).XScale = 'log';
set(ax(2),'xtickmode','auto');
ax(2).YTickLabel = {};
end
hold off;
end