Functions for genetic algorithms
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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?
Respuestas (0)
Ver también
Categorías
Más información sobre Genetic Algorithm en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!