This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linear_vfop.asv
106 lines (75 loc) · 2.81 KB
/
linear_vfop.asv
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
92
93
94
95
96
97
98
99
100
101
102
103
104
%Code written by Ankur Sinha
%Version: 18072011
%Note: Give non-dominated points only
%Positive epsilon value denotes that the value function correctly fitted the decision maker preferences.
function result = linear_vfop( obj, show )
%Example Partial ordering
%obj = [3.6 3.9 1; 2.5 4.1 2; 5.5 2.5 3; 0.5 5.2 3; 6.9 1.8 4];
if show == true
plot(obj(:,1),obj(:,2), '*r');
hold on
arrow = [];
for i=1:size(obj,1)
%arrow(i,:) = '\leftarrow';
arrow(i,:) = 'P';
end
text(obj(:,1),obj(:,2)+0.2,[arrow(:,:) num2str(obj(:,3))]);
end
%Value function optimization.
%Refer: K. Deb, A. Sinha, P. Korhonen, and J.Wallenius.
%An interactive evolutionary multi-objective optimization method based on
%progressively approximated value functions. IEEE Transactions on Evolutionary
%Computation, 14(5):723739, 2010.
% EKS -- Set optimization options
options = optimoptions('fmincon', 'MaxFunctionEvaluations', 10000);
% EKS -- passing obj to @con
[z,fval,~,~,~] = fmincon(@fun,0.5.*ones(3,1),[],[],[],[],[0 0 -1000]',[1 1 1000]', @(x) con(x, obj), options);
if fval>0
disp('Information not correctly fitted');
else
disp('Information fitted correctly');
end
OptimizationParameters = z; %First six are value function parameters and the last one is epsilon
for i=1:size(obj,1)
u(i)= utilfunc(obj(i,:),z);
end
if show == true
for i=1:size(obj,1)
fh = @(x,y) (x*z(1)+y*z(2)) - u(i);
ezplot(fh, [min(obj(:,1))-1, max(obj(:,1))+1]);
end
title('');
axis([min(obj(:,1)) max(obj(:,1)) min(obj(:,2)) max(obj(:,2))])
xlabel('f_1')
ylabel('f_2')
end
Utilities = u;
result = struct('OptimizationParameters', OptimizationParameters, 'Utilities', Utilities);
end
%% Functions
% start -- Objective function that simply inverts the ranking value in the input
function f=fun(x)
f = -x(end);
end
% end -- Objective function
% start -- Constraint function
function [c, ceq]=con(x)
global obj;
delta = 0.1;
for i=1:size(obj,1)-1
if obj(i,3) ~= obj(i+1,3)
c(i) = -((utilfunc(obj(i,:),x))-(utilfunc(obj(i+1,:),x))) + x(end); % IMK - x(end) is epsilon
% Minimization version
%c(i) = -((utilfunc(obj(i+1,:),x))-(utilfunc(obj(i,:),x))) + x(end); % IMK - x(end) is epsilon
else
c(i) = abs((utilfunc(obj(i,:),x))-(utilfunc(obj(i+1,:),x))) - delta*x(end); % IMK - x(end) is epsilon
end
end
ceq(1)=x(1) + x(2) - 1;
end
% end -- Constraint function
% start -- Utility function
function u=utilfunc(obj,x)
u = obj(1)*x(1)+obj(2)*x(2);
end
% end -- Utility function