-
Notifications
You must be signed in to change notification settings - Fork 1
/
paretofront.m
64 lines (63 loc) · 1.6 KB
/
paretofront.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
function [] = paretofront(varargin)
% PARETOFRONT returns the logical Pareto Front of a set of points.
%
% synopsis: front = paretofront(M)
%
%
% INPUT ARGUMENT
%
% - M n x m array, of which (i,j) element is the j-th objective
% value of the i-th point;
%
% OUTPUT ARGUMENT
%
% - front n x 1 logical vector to indicate if the corresponding
% points are belong to the front (true) or not (false).
%
% By Yi Cao at Cranfield University, 31 October 2007
%
% Example 1: Find the Pareto Front of a circumference
%
% alpha = [0:.1:2*pi]';
% x = cos(alpha);
% y = sin(alpha);
% front = paretofront([x y]);
%
% hold on;
% plot(x,y);
% plot(x(front), y(front) , 'r');
% hold off
% grid on
% xlabel('x');
% ylabel('y');
% title('Pareto Front of a circumference');
%
% Example 2: Find the Pareto Front of a set of 3D random points
% X = rand(100,3);
% front = paretofront(X);
%
% hold on;
% plot3(X(:,1),X(:,2),X(:,3),'.');
% plot3(X(front, 1) , X(front, 2) , X(front, 3) , 'r.');
% hold off
% grid on
% view(-37.5, 30)
% xlabel('X_1');
% ylabel('X_2');
% zlabel('X_3');
% title('Pareto Front of a set of random points in 3D');
%
%
% Example 3: Find the Pareto set of a set of 1000000 random points in 4D
% The machine performing the calculations was a
% Intel(R) Core(TM)2 CPU T2500 @ 2.0GHz, 2.0 GB of RAM
%
% X = rand(1000000,4);
% t = cputime;
% paretofront(X);
% cputime - t
%
% ans =
%
% 1.473529
error('mex file absent, type ''mex paretofront.c'' to compile');