I am implementing clustering using BFO with dataset. However I have matlab code for it. But I want to find the cost function in java specially the parameters of J.

The code is attached. X is the dataset. Suggest how to find the Cost function:

======================

ww=ones(150,3);

for m=1:s % the initital posistions

wh=randint(1,1,[1 150]);

P(1,m,1,1,1)= X(wh,1);

P(2,m,1,1,1)=X(wh,2);

P(3,m,1,1,1)=X(wh,3);

P(4,m,1,1,1)=X(wh,4);

end

for ell=1:Ned

%Reprodution loop

for K=1:Nre

% swim/tumble(chemotaxis)loop

for j=1:Nc

for i=1:s

J(i,j,K,ell)=Live_fnn(ww,X,P(:,i,j,K,ell)); %COST FUNCTION

% Tumble

Jlast=J(i,j,K,ell);

Delta(:,i)=(2*round(rand(p,1))-1).*rand(p,1);

P(:,i,j+1,K,ell)=P(:,i,j,K,ell)+c(i,K)*Delta(:,i)/sqrt(Delta(:,i)'*Delta(:,i));

Similar questions and discussions