非線形制約条件付きGAのcrossoverintermediateに関するエラー
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
非線形制約条件付きのGAを用いたシミュレーションを行っていたところ,以下のエラーが表示されます.
位置 1 のインデックスが無効です。配列インデックスは正の整数または logical 値でなければなりません。
エラー: crossoverintermediate (line 47)
parent1 = thisPopulation(parents(index),:);
エラーで一時停止したところ,配列parentsの中の要素がすべて0になっており,配列thisPopulationの要素を呼び出せなくなっていました.
配列parentsの中の要素がすべて0になるのを防ぐためにはどうすればいいのでしょうか.すべてのエラー文を以下に記します.
位置 1 のインデックスが無効です。配列インデックスは正の整数または logical 値でなければなりません。
エラー: crossoverintermediate (line 47)
parent1 = thisPopulation(parents(index),:);
エラー: stepGA (line 34)
xoverKids = feval(options.CrossoverFcn, parents(1:(2 *
nXoverKids)),options,GenomeLength,FitnessFcn,thisScore,thisPopulation,options.CrossoverFcnArgs{:});
エラー: galincon (line 62)
[score,population,state] =
stepGA(score,population,options,state,GenomeLength,FitnessFcn);
エラー: gacon (line 78)
[~,Iterate.f,innerExitFlag,innerOutput,innerPopulation,innerScore] = ...
エラー: ga (line 405)
[x,fval,exitFlag,output,population,scores] = gacon(FitnessFcn,nvars, ...
エラー: optim (line 7)
[x,fval,exitflag,output,population,scores] = ga(@fun,8,[1 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0; 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0; 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 1
0],[0.3;0.3;0.1;0.3;0.3;0.1],[],[],[0 0 0 0 0 0 0 0],[],@nonlcon,options);
11 commentaires
Aoi Midori
le 21 Déc 2018
MathWorksさんからご回答貰えたようでよかったです。ご解決おめでとうございます!また、回答の共有もありがとうございます。今後参考にさせていただきます。
Réponses (0)
Voir également
Catégories
En savoir plus sur ソルバーの選択 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!