Functions for genetic algorithms
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
When I run rastriginsfcn.m using optimization toolbox, GA solver, the final value of the fitness function when the algorithm terminated:
Objective function value: 0.05531602101322264 and the final point, which in this example is [0.001 -0.017].
The following are the code for rastriginsfcn.m:
function scores = rastriginsfcn(pop)
% pop = max(-5.12,min(5.12,pop));
scores = 10.0 * size(pop,2) + sum(pop .^2 - 10.0 * cos(2 * pi .* pop),2);
Are the above the complete code for rastriginsfcn.m? How does the code specify the initial population? How does the code specify that this function needs 2 variables (i.e x and y)? How does the code specify that x and y are to be generated randomly?
Réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!