how can i generate this chromosome?
2 ビュー (過去 30 日間)
古いコメントを表示
how can i generate this chromosome? I tried to generate randomly this chromosome [2 2 3 1 2 3 1 1 3]. this chromosome represents that I have 3 jobs and each job has 3 tasks. I need this chromosome to use genetic algorithm.
0 件のコメント
採用された回答
Joseph Cheng
2014 年 9 月 9 日
I would start by creating an array containing the numbers you want in it and then using randperm to generate a random random order.
Numjobs = 3;
NumTask = 3;
chromosome = repmat(1:NumTask,Numjobs,1);
order = randperm(NumTask*Numjobs);
chromosome = chromosome(order)
その他の回答 (1 件)
sejo
2014 年 9 月 9 日
hy, try this:
chrom=randi([1,3],1,9)
2 件のコメント
isuru senevirathne
2018 年 5 月 24 日
chrom=randi([1,10],1,9)
you can not make to repeat each number in three times , becuse it is randomly generate
参考
カテゴリ
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!