-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotagelayers.m
59 lines (49 loc) · 1.36 KB
/
plotagelayers.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
% load('tmp') % tmp is generated with the parsecosts.py
age_gap = 10
max_nb_age_layers = 10
nb_gens = size(tmp, 1) - 1;
nb_layers = 1 + floor(nb_gens / age_gap);
gen_ids = tmp(1:end-1,1);
costs = tmp(1:end-1, 2:end);
figure
hold on
colors = {};
colors{end+1} = 'b.-';
colors{end+1} = 'g.-';
colors{end+1} = 'c.-';
colors{end+1} = 'm.-';
colors{end+1} = 'r.-';
colors{end+1} = 'b.--';
colors{end+1} = 'g.--';
colors{end+1} = 'c.--';
colors{end+1} = 'm.--';
colors{end+1} = 'r.--';
age_layers = {}
for i=1:nb_layers
layer.starts_at = (i-1) * age_gap + 1;
layer.id = i;
layer.xvals = [];
layer.yvals = [];
age_layers{i} = layer;
end
for gen=1:length(gen_ids)
base_age_layer = max(0, floor(((gen-1) / age_gap) - max_nb_age_layers + 1));
% the first max_nb_age_layers layers
for i=1:max_nb_age_layers
cost = costs(gen, i);
if cost < 0
age_layers{i+base_age_layer}.xvals = [age_layers{i+base_age_layer}.xvals gen_ids(gen)];
age_layers{i+base_age_layer}.yvals = [age_layers{i+base_age_layer}.yvals cost];
end
end
end
% layer_starts_at = min(find(costs(:, i) < 0.0));
%
% xvals = gen_ids(layer_starts_at:end);
% yvals = costs(layer_starts_at:end, i);
for i=1:nb_layers
layer = age_layers{i};
plot(layer.xvals, layer.yvals, colors{mod(i, length(colors))+1});
plot(gen_ids, costs(:, 1), 'k*');
end
grid