Im trying to code my fitness function with just one constraint inside that m.file but i run into and error that says
"Undefined function 'count' for input arguments of type 'logical'.Error in my_fun (line 22) if count (L == 1) == 1; "
I don't really how to fix it. the following is the piece of code.
function y = my_fun(c1) w1 = 0.8;% w2 = 0.8;
% w3 = 0.8;
% y = w1*x1 + w2*x2 + w3*x3;
X=xlsread('Dataset.xlsx'); % Xout=X(:,end);
D = 1:5;T = 1:9;L = 1:26;chromosome = [D T L];%Constraint 1
for DateID = D for TimeID = T if count (L == 1) == 1; c1 = 0; else c1 = 1; end endendy = w1*c1;
In here, im trying to define my chromosome in the form of [D T L] and also assigning the ID in my dataset to be the genotype. In constraint 1, im trying to find if the L have violated the constraints and it gives the value 1, and if not then 0.
PLease advice. thanks.
Best Answer