30.01.2015 Views

Editura Sfântul Ierarh Nicolae ISBN 978-606-577-027-0

Editura Sfântul Ierarh Nicolae ISBN 978-606-577-027-0

Editura Sfântul Ierarh Nicolae ISBN 978-606-577-027-0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

-=PopulatieVeche[r2].fitness;<br />

}<br />

}<br />

3. Selectia aranjata<br />

void SelectieParintiAranjata(int &r1, int &r2)<br />

{<br />

int s,r;<br />

s=MaxPopulatie*(MaxPopulatie+1)/2;<br />

/*pentru primul parinte*/<br />

r=1+random(s);<br />

r1=0;<br />

while (r>0)<br />

{<br />

r1++;<br />

r-=r1;<br />

}<br />

/*pentru al doilea parinte*/<br />

r=1+random(s);<br />

r2=0;<br />

while (r>0)<br />

{<br />

r2++;<br />

r-=r2;<br />

}<br />

}<br />

14

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

Saved successfully!

Ooh no, something went wrong!