How to find the index of a particular child when using use parallel = True option in genetic algorithm optimizer?
2 ビュー (過去 30 日間)
古いコメントを表示
Sravan Kumar Kanchari Bavajigari
2022 年 6 月 30 日
コメント済み: Sravan Kumar Kanchari Bavajigari
2022 年 7 月 6 日
I am using genetic algorithm in global optimization toolbox.
I have an objective function within which
i) I create directories
ii) run an executable using system() command
iii) write and read files to evaluate the objective function for a given child
I would like to evaluate the objective function for different childs in parallel using the UseParallel=True option. However, I would need to know the index of the particular child in the population so that I can create a directory with the name corresponding to the index of the particular child. This would mean that I will need to use the index of the child within my objective function.
So, my question is how to find the index of a particular child when using the parallel option in genetic algorithm optimizer?
It would also be great if there is a solution to find the index during parallel operation of other optimizers (eg: patternsearch, etc.,) in MATLAB as well. Thank you.
0 件のコメント
採用された回答
Matt J
2022 年 6 月 30 日
編集済み: Matt J
2022 年 6 月 30 日
If you have the Parallel Computing Toolbox, set UseParallel=false and UseVectorized=true. Then, inside your objective function and constraints, you will have access to all poopulation members and their indices. You can use parfor or other PCT tools to parallel-split the operations within those functions, but with full control over the splitting.
3 件のコメント
Matt J
2022 年 6 月 30 日
編集済み: Matt J
2022 年 6 月 30 日
When UseVectorized=true, the fitness and constraint functions will be passed an MxN matrix in each generation, where each row of the matrix is a population member. In this case, your functions are responsible for processing the entire population in a single call, see also,
その他の回答 (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!