Parallel pool goes idle instantly in parallel GA
23 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am working on a project, where a fitness function of GA executes a bash script, part of which is a OpenFOAM simulation run. (on Linux, Ubuntu 20.04). Below is the fragment of code where the GA is being launched:
options = optimoptions('ga', 'UseParallel', true, 'UseVectorized', false ,'MaxGenerations', 500, 'MaxStallGenerations', 500, 'Display', 'iter', 'CreationFcn', @initialValidPopulation);
ga_values = ga(@calculate_case, ...
2*n, [], [], [], [], zeros(2*n, 1), 0.5*ones(2*n, 1), ...
[], options);
The MATLAB recognizes UseParallel flag and starts the pool automatically, the bottom left corner icon goes green for a few seconds and then goes blue signalizing it's idle. Also only one fitness function is executed. The same happens if I create a parallel pool manually.
What could be a source of this behavior?
採用された回答
Matt J
2022 年 1 月 7 日
編集済み: Matt J
2022 年 1 月 7 日
It sounds like you'll need to send your code to tech support in a bug report..
As a temporary workaround, set UseVectorized to true, instead. Then, use a parfor loop within your fitness function to process each row of the population matrix.
3 件のコメント
Matt J
2022 年 1 月 7 日
You are welcome, but if the answer works for you, please consider Accept-clicking it.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!