-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotCosts_mopso.m
44 lines (29 loc) · 953 Bytes
/
PlotCosts_mopso.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
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPEA121
% Project Title: Multi-Objective Particle Swarm Optimization (MOPSO)
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Contact Info: [email protected], [email protected]
%
function PlotCosts(pop,rep)
pop_costs=[pop.Cost];
rep_costs=[rep.Cost];
if size(pop_costs, 1) == 2
plot(pop_costs(1,:),pop_costs(2,:),'ko');
hold on;
plot(rep_costs(1,:),rep_costs(2,:),'r*');
xlabel('1^{st} Objective');
ylabel('2^{nd} Objective');
else
plot3(rep_costs(1, :), rep_costs(2, :), rep_costs(3, :), 'o');
hold on;
plot3(pop_costs(1, :), pop_costs(2, :), pop_costs(3, :), '+');
end
grid on;
hold off;
end