Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear
- space = [-500 * ones(1,10);500*ones(1,10)];
- Newpop = genrpop(30,space); %vygeneruje populaciu
- space1 = 2*ones(1,10);
- for i = 1: 500
- fitness = schwefel(Newpop);
- M(i) = min(fitness);
- bestOfbest = selbest(Newpop,fitness,10);
- novaPopulacia = seltourn(Newpop,fitness,20); %n-b
- novaPopulacia = mutx(novaPopulacia, 0.1,space);
- novaPopulacia = muta(novaPopulacia, 0.1,space1,space);
- Newpop = [novaPopulacia; bestOfbest];
- end
- figure
- plot(M, 'r')
- hold on
Advertisement
Add Comment
Please, Sign In to add comment