Can one of MATLAB's optimization algorithms (e.g. particle swarm optimization) take the place of this brute force parameter sweep iteration?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Paul Safier
le 9 Août 2022
Commenté : Paul Safier
le 11 Août 2022
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
0 commentaires
Réponse acceptée
Walter Roberson
le 9 Août 2022
In theory, NO, none of those functions can take the place of a parameter sweep for a generalized calculation.
There are calculations for which it can be proven that knowing the value of a function at any finite number of locations does not give you information about the value of the function at a given location.
There are functions that there is no known way to calculate, such as the list of locations at which the prime number estimate function swaps between being an overestimate and underestimate.
So, it cannot always be done.
Whether it is possible for your calculation depends upon what you are calculating.
There is a set of functions for which unconstrained Genetic Algorithm is guaranteed to converge. It has been rather some time since I last looked at the relevant theory; my vague memory is that it is not much better than Quadratic functions. Unless, that is, you go by definitions such as https://www.researchgate.net/publication/220616519_Convergence_Criteria_for_Genetic_Algorithms which says that provided that you mutate long enough that you will get convergence (they give upper bounds on number of iterations for some conditions, but I cannot read the paper myself.)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Particle Swarm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!