Functions for genetic algorithms

2 ビュー (過去 30 日間)
Dua
Dua 2012 年 10 月 29 日
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?

回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by