Does that seem correct?
top_x = pop(b(1:options.topSize),:)
The code for Generating the initial population is This:
M = 50; % population size
n = 2;
pop = -50 + 100.*rand(M,n);
. This is done in a for loop. See Here for the entire code figure;
scatter(pop(:,1), pop(:,2), 'x'); and
figure;
scatter(top_x(:,1),top_x(:,2), 'x');
% Criteria for selecting top 'topSize' individuals based on fitness
% values(eval)
if strcmp(options.optmType, 'min')
[void, b] = sort(eval, 'descend'); % maximising
else
[void, b] = sort(eval, 'ascend'); % minimising
end
pop = pop(void);
top_x = pop(b(1:options.topSize),:); % select top individuals
optm_x = pop(b(1),:); % save optimal parameter
fv = eval(b(1)); % save optimal func. value
Subscript indices must either be real positive integers or logicals.
Error in ==> Imp
pop = pop(void);
void = round(void)
pop = pop(void)
??? Index exceeds matrix dimensions.
Error in ==> Imp at
pop = pop(void);
pop = mvnrnd(mu,Sigma,M)
Title | # Comments | Views | Activity |
---|---|---|---|
count11 challenge | 6 | 47 | |
Magic Software info | 18 | 102 | |
wordcount challenge | 11 | 75 | |
silent install of security banner via msiexec command | 4 | 48 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!