PCT and GA optimizer

6 views (last 30 days)
Nima PEDRAMASL
Nima PEDRAMASL on 18 Jan 2014
Edited: Matt J on 19 Jan 2014
Hi, I try to use parallel computing toolbox to decrease genetic algorithm optimizer run time. all of workers will call an external solver using one premade input file.(call MSC Nastran bdf is made in MATLAB). the thing is each time external solver is called some files are created.to avoid conflict between workers three options came to my mind. 1) use of resource lock to avoid conflict but this will bring problems since other workers solver dont wait and will fail. 2) tell PCT to create directory for each worker and copy necessary files into each directory. 3) in objective function get process id of each worker and put an extension in input file made by objective function for external solver therefore each workers will have different output and input file name.
the last option looks like the easiest one. what do you guys think ? and btw I dont know method 2 and 3. need some help :) thanks in advance

Accepted Answer

Matt J
Matt J on 19 Jan 2014
Edited: Matt J on 19 Jan 2014
If you use the Vectorize option, you can have GA pass the entire population to your objective function in each iteration. Within your objective function, you can then implement your own parallel splitting of the computation using Parallel Computing Toolbox functions.
For example, you can evaluate different population chunks in parallel in an SPMD...END block and use the labindex() command to create a worker-dependent name for your files,
spmd
...
filename=[filename numstr(labindex)];
end
  1 Comment
Nima PEDRAMASL
Nima PEDRAMASL on 19 Jan 2014
yep that's what I need. Thanks Matt, much appreciated.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!