How to run parallel optimization when fitness function uses input/output files for [X] and [F].
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am "gamultiobj" for multiobjective optimization. my fitness function is as below. It calls a Fortran compiled file (CNEW.exe) to calculate the objective functions. Input variables [X] from the optimiser are written to a file "xinput" which is read by CNEW.exe and it write the function values in "fout.txt". All works fine when fitness function evaluation setting is on "in serial". I tried to use paralell computation in MATLAB to reduce the time. It seems that parallel processing works fine as I can see in the task manager each core runs an individual CNEW.exe task. But since all of them communicate with the same in/out files on the hard drive, the oucome is terribly mixed and optimization goes wrong. Can someone please tell me what should I do?
function y = mymgt(x)
%write the x data
xh = fopen('xinput.txt', 'w');
fprintf(xh, '%f %f %f\n', x);
fclose(xh);
%run the program
system('CNEW.exe');
%read the f data
fh = fopen('fout.txt');
y = fscanf(fh, '%f %f');
fclose(fh);
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Surrogate Optimization finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!