Parallel computing for genetic algorithm
Mostra commenti meno recenti
i have an objective function that calls an external program for optimization work. Running and getting results of objective function is very time consuming since the external program works really slow.
i want to distrubute the population generation task to 4 workers. But every worker must first copy the objective function folder which has an external function files in it into a seperate folder and then run the external program in that folder. this way, external program doesnt confused since it works seperately.
im using this file:
it has this code in evaluate.m file for parallel computing;
parfor i = 1:N
fprintf('\nEvaluating the objective function... Generation: %d / %d , Individual: %d / %d \n', state.currentGen, opt.maxGen, i, N);
[pop(i), allTime(i)] = evalIndividual(pop(i), opt.objfun, varargin{:});
end
function [indi, evalTime] = evalIndividual(indi, objfun, varargin)
[y, cons] = objfun( indi.var, varargin{:} );
What should be done in parfor loop above in order to create seperate working folder that has a copied external program files in it for each worker ?
thank you
3 Commenti
Alberto Mora
il 1 Giu 2020
Modificato: Alberto Mora
il 1 Giu 2020
Honesty I don't know to do what you want, but one possible solution to speed-up genetic algorithm optimization, is to use "vectorized" population.
Ugur Acar
il 1 Giu 2020
Ugur Acar
il 1 Giu 2020
Risposte (0)
Categorie
Scopri di più su Surrogate Optimization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!