Can one of MATLAB's optimization algorithms (e.g. particle swarm optimization) take the place of this brute force parameter sweep iteration?
Show older comments
I want to find an optimal set of parameters but the time to run through every combination (in a brute force parameter sweep) will be too much computation time. Can particle swarm optimization (or another algorithm) be used instead? The code is not written stricly as a function like the documentation examples use...
I want the values of var1, var2 and var3 that minimize the output value, out1.
var1 = (-60:0.1:60)';
var2 = (-110:0.1:110)';
var3 = (3.5:0.1:18.5)';
% Set up the design matrix, desMat
desMat = {var1,var2,var3};
[desMat{:}]=ndgrid(desMat{:});
n=length(desMat);
desMat = reshape(cat(n+1,desMat{:}),[],n);
parfor kk = 1:NS
var1a = desMat(kk,1); var2a = desMat(kk,2); var3a = desMat(kk,3);
[out1] = Function_Pd(var1a,var2a,var3a);
end
Accepted Answer
More Answers (0)
Categories
Find more on Particle Swarm 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!