How can i optimize distance Matrix that construct phylogenetic tree ??
0
0
Entering edit mode
7.8 years ago

I tried to optimize distance matrix that construct phylogenetic tree by differential evolution algorithm and i need to sure about my implementation and this is my code about that , please anyone can help me

function [working_distance_after_50_itr] = working_distance_Matrix()

n = 5; %number of species

u = importdata('original distance.txt');

d = u(~~tril(u));

t = importdata('initial working distance.txt'); x = t(~~tril(t));

itr=input('Enter no. of generations: ');

F = 0.01; %Mutation factor

for j = 1 : itr

for i = 1 : length(x)

%y = x;

b = x(i);

s = setdiff(x,b);

r1 = s(randi(numel(s),1,1));

b = [x(i),r1];

s = setdiff(x,b);

r2 = s(randi(numel(s),1,1));

%b = [x(i),r1,r2];

%s = setdiff(x,b);

%r3 = s(randi(numel(s),1,1));

c(i) = x(i) + (F * (r1 - r2)); %Mutant vector

end

if fitness(c)>= fitness(x) %selection step

x = c;

end

end

g = tril(ones(n),-1);

g(~~g)=x;

working_distance_after_50_itr =tril(g,-1)+tril(g)';

function fitness_value = fitness(N)%fitness function

for k = 1 : length(N)

r(k)=((N(k)- d(k))/d(k))^2;

end

z = sum(r);

a = (n*(n-1))/2;

h = 1/(a-1);

fitness_value = 1/(100 * sqrt(h*z));

end

end

phylogenies optimization Differential Evolution • 1.2k views
ADD COMMENT

Login before adding your answer.

Traffic: 2363 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6