How to write matlab code for optimization of this equation ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Seshadri Behera
le 11 Août 2014
Commenté : Seshadri Behera
le 11 Août 2014
Hello, I want to optimize the following equation with particle swarm optimization algorithm. f(x)=(1/(n*xmax))* (summation(xi)) ; where i is the index varying from 1 to n, xmax is the maximum value of x & range of x is (0.003, 316.2).
0 commentaires
Réponse acceptée
Johan Löfberg
le 11 Août 2014
Modifié(e) : Johan Löfberg
le 11 Août 2014
Do you absolutely have to use particle swarm optimization?
I would conjecture that the optimal solution is to let all but one element take the value 0.003, and the last element the value 316.2
The following test shows that this is the case for your setup. It uses the MATLAB Toolbox YALMIP to formulate the problem, and assumes you have a mixed-integer solver installed
n = 20;
m = 0.003;
M = 316.2;
x = sdpvar(n,1);
% Conjecture
xbest = [repmat(m,n-1,1);M];
costbest = sum(xbest)/(length(xbest)*max(xbest));
% Recover the conjectured solution by stating problem as mixed-integer problem
solvesdp([m <= x <= M, sum(x) <= length(x)*max(x)*costbest])
% Try to obtain a slightly better solution will fail and lead to
% infeasibility
solvesdp([m <= x <= M, sum(x) <= length(x)*max(x)*costbest*0.9999])
Shouldn't be too hard to prove that the conjecture holds.
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!