??? Attempted to access x(2); index out of bounds because numel(x)=1.
Error in ==> fit_fun at 5
Fit_fun_val= x(1)^2 + x(2)^2 + x(3)^2;
Error in ==> jack_immune at 47
Sel_Ab_cri(ksel)=fit_fun(Ini_Ab(:,ksel));
The problem is the data is being read 1 at a time, but from the fitness function, 3 datas are required. Can someone pls help me on the solution? Thanks in advance. My email is dyfw@hotmail.com
Thanks Mr. Mehdi for your reply on the previous post.
Now, I'm trying to find the solution for the dejong2 function using your code. I received the same error as below. Can you advice and comment on the problem?
??? Attempted to access p(2); index out of bounds because numel(p)=1.
Error in ==> fit_fun at 12
Fit_fun_val(i) = 100 * (p(1)^2 - p(2)) ^2 + (1 - p(1))^2;
Error in ==> jack_immune at 48
Sel_Ab_cri(ksel)=fit_fun(Ini_Ab(:,ksel));
The fit_fun.m (dejong2) content is as below:-
function Fit_fun_val=fit_fun(v)
Fit_fun_val = zeros(size(v,1),1);
for i = 1:size(v,1)
p = v(i,:);
Fit_fun_val(i) = 100 * (p(1)^2 - p(2)) ^2 + (1 - p(1))^2;
end
Can someone pls help me on the solution? Thanks in advance. My email is dyfw@hotmail.com
How can i include a range for the fitness function so that the program can search/optimize just that particular range?
example, I would like to search only within the range -3<x<8 and -8<y<20 for fitness function of f(x) = x^3 + x^2y^2 + y^4
Thus, the optimized value should should be x between -3 and 8; and y between 8 and 20.
I would like to thank you in advance and really appreciate your help.
Dear Mr. Mehdi, Appreciate your help and assistance for the above:-
I would like to search only within the range -3<x<8 and -8<y<20 for fitness function of f(x) = x^3 + x^2y^2 + y^4
Appreciate your help. My email is dyfw@hotmail.com
Dear Mr. Mehdi,
i wonder about the redundant function evaluations after cloning .
why shouldn't we do maturation immediately after cloning instead of fitness calculation..
thank u for your code and reply in advance..