30.06.2013 Views

Leader (and sub Leader) Election per uniformare e ... - Automatica

Leader (and sub Leader) Election per uniformare e ... - Automatica

Leader (and sub Leader) Election per uniformare e ... - Automatica

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

v = ones(dim(1,1),1) - v;<br />

s = 0;<br />

while (norm(v) > 0)<br />

s = s + 1;<br />

v = F * v;<br />

end<br />

%Alla fine delle iterazioni s rappresenta<br />

%il numero di livelli dell’albero<br />

TempoInterRadice = s;<br />

xMaxBatOTTIMA(:,2) = F * ones(dim(1,1),1);<br />

z = 0;<br />

for i = 2:tempo<br />

messinvio = (eye(dim(1,1))-Phi(radicesucc)) * ((eye(dim(1,1))-<br />

Phi(radiceatt))*xMaxBatOTTIMA(:,(i-1)) + ones(dim(1,1),1));<br />

A = A + xMaxBatOTTIMA(:,(i-1)) + messinvio + ones(dim(1,1),1);<br />

B = A + xMaxBatOTTIMA(:,i);<br />

n = B(1,1);<br />

pos = 1;<br />

for j = 2:dim(1,1)<br />

if (B(j,1) > n)<br />

n = B(j,1);<br />

pos = j;<br />

end<br />

end<br />

JMaxBatOTTIMALivelloMinimo(i,1) = n;<br />

z = z + 1;<br />

if (z == TempoInterRadice)<br />

[radicefut,F] = RadiceMassimaBatteriaFigliEquispaziati (B,Mg);<br />

% Trovo il numero di livelli dell’albero<br />

v = F * ones(dim(1,1),1); % Gli elementi nulli del vettore<br />

% v corrispondono alle foglie<br />

v = ones(dim(1,1),1) - v;<br />

s = 0;<br />

while (norm(v) > 0)<br />

s = s + 1;<br />

v = F * v;<br />

end<br />

%Alla fine delle iterazioni s rappresenta<br />

%il numero di livelli dell’albero<br />

TempoInterRadice = s;<br />

55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!