필터 지우기
필터 지우기

How to write matlab code for optimization of this equation ?

조회 수: 2 (최근 30일)
Seshadri Behera
Seshadri Behera 2014년 8월 11일
댓글: Seshadri Behera 2014년 8월 11일
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).

채택된 답변

Johan Löfberg
Johan Löfberg 2014년 8월 11일
편집: Johan Löfberg 2014년 8월 11일
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.
  댓글 수: 1
Seshadri Behera
Seshadri Behera 2014년 8월 11일
Thank you for the answer. But it's an assignment to use PSO to optimize this equation. So I must write the code using PSO.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by