calling a function for mutation operator but getting error
16 ビュー (過去 30 日間)
古いコメントを表示
I am calling following function, but getting error (Undefined function or variable 'parent_genotype')
genotype = mutation_new(parent_genotype,mutation_rate,n_genes_mutated,total_jobs);
data in mutation_new.m file is as under
function genotype = mutation_new(parent_genotype,mutation_rate,n_genes_mutated,total_jobs)
population_size = 5;
mutation_rate = 0.1;
total_jobs=50;
parent_genotype = randperm(total_jobs);
b = parent_genotype;
population_matrix = zeros(population_size,total_jobs);
n_genes_mutated = length(parent_genotype)*mutation_rate;
for i = 1:n_genes_mutated/2
num1 = randi(total_jobs,1);
num2 = randi(total_jobs,1);
b([num1 num2]) = b([num2 num1]);
end
genotype = b;
0 件のコメント
回答 (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!