Parallel computing for genetic algorithm
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!