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 日
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.
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.