How to find the index of a particular child when using use parallel = True option in genetic algorithm optimizer?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Sravan Kumar Kanchari Bavajigari
il 30 Giu 2022
Commentato: Sravan Kumar Kanchari Bavajigari
il 6 Lug 2022
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 Commenti
Risposta accettata
Matt J
il 30 Giu 2022
Modificato: Matt J
il 30 Giu 2022
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 Commenti
Matt J
il 30 Giu 2022
Modificato: Matt J
il 30 Giu 2022
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,
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Genetic Algorithm in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!