我想在Matlab中基于NSGA2
遗传算法编写两个目标函数,但是,我很困惑输入染色体来评估我的目标,并且在我的目标函数中,染色体未使用,我不知道如何评估目标函数到我的函数调用所在的染色体,并且我将evaluateObjective(chromosome(ii,:), V)
按照参数进行输入。
S = [0.9 0.8 0.3 0.3];
W = [0.9 0.7 0.4 0.1];
P = [15 17 18];
T = [13 14 13];
V=4;
我的愿望功能:
Obj1: for all w belongs to W and p belongs to P
summation of (w*p)
Obj2: for all t belongs to T and s belongs to S
summation of (t*s)
和目标函数:
function f = evaluateObjective(x, V) %x is the choromosome
% Objective function 1
sum = 0;
for i = 1 : V - 1
sum = sum - W((i))*P;
end
f(1) = sum;
% Objective function 2
sum = 0;
for i = 1 : V
sum = sum + S*S(i);
end
f(2) = sum;
end