Functions for genetic algorithms
조회 수: 3 (최근 30일)
이전 댓글 표시
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 Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!