Parallel computing for genetic algorithm

1 visualización (últimos 30 días)
Ugur Acar
Ugur Acar el 1 de Jun. de 2020
Comentada: Ugur Acar el 1 de Jun. de 2020
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 comentarios
Ugur Acar
Ugur Acar el 1 de Jun. de 2020
Alberto Mora thank you for your answer. you are right i may not explain the problem clearly.
My objective funtion calls an external program. if each worker calls the objective function at the same time,it cannot evaluate objective function. so, before the worker call the objective function in parfor loop, objective function folder must be copied and the worker should work in that seperate folder.
Ugur Acar
Ugur Acar el 1 de Jun. de 2020
Or,
i created 4 folders and copied necessary external program files into these folders before running optimization algorithm. Let say folder names are worker1,worker2, worker3 and worker4.
I have quadcore machine and i want 4 parallel jobs at the same time.
how sud i make sure each worker evalute the objective function in differents folders (worker1,worker2, worker3 and worker4 folders)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Surrogate Optimization en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by