-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphEvaluation.m
More file actions
48 lines (40 loc) · 1.6 KB
/
GraphEvaluation.m
File metadata and controls
48 lines (40 loc) · 1.6 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
%*************************************************************************%
%@BeginVerbatim
% Function: GraphEvaluation
% Description: Create an overview of the performance of the genetic algorithm for the traveling salesman
% Parameter(s): evaluation_history, matrix;
% Filename: GraphEvaluation.m
% Version: v00.02
% Author: Group 1
% Yr&Sec: 3-4
% Subject: Computational Intelligence
%@EndVebartim
%*************************************************************************%
% Last Reviewed by: Periabras, 17 February 2017
%@Code Body***************************************************************%
function [ ] = GraphEvaluation( evaluation_history )
%@Intialization*******************************************************%
x = []; %all x coordinates
y = []; %best and worst scores
z = []; %average scores
%*********************************************************************%
%Loop throught the whole evaluation for every 6% of the total length of
% evaluation
for cnt = 1:ceil(length(evaluation_history)*0.06):length(evaluation_history)
x = cat(1,x,cnt);
y = vertcat(y,evaluation_history(cnt,1:2));
z = cat(1,z,evaluation_history(cnt,3));
end
%Create Graph
hold on;
axis([-10 length(evaluation_history)+10 0 70]);
bar(x,y);
title('Overview of Performance');
xlabel(strcat('Generations: ',num2str(length(evaluation_history))));
ylabel('Fitness');
plot(x,z);
plot(x,z,'or');
legend('Best', 'Worst', 'Average');
hold off;
end
%*************************************************************************%