如何改变它是多目标算法(FOPID) ?谁能帮我吗?

2视图(30天)
下面的程序是一个简略pso(分数阶pid)。(附加文件)
如何改变它是多目标算法(FOPID) ?
% % % % % %装机使用粒子群优化FOPID控制器
% % % % %初始化
clc
清晰的
n = 15;%的大小群“不鸟”
bird_setp = 3;%最大数量的“鸟步骤”
昏暗的= 15;%问题的维度
c2 = 2.1;%算法参数C1
c1 = 1.2;% C2算法参数
w = 0.9;% pso动量或惯性
健身= 0 (n, bird_setp);
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
%初始化参数%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
R1 =兰德(暗,n);
R2 =兰德(暗,n);
current_fitness = 0 (n, 1);
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
%初始化群和速度和位置%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
current_position =兰德(暗,n);
速度= 3 *兰德(暗淡,n);
local_best_position = current_position;
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
%计算初始种群%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
i = 1: n
Kp1 = current_position (1,);Ki1 = current_position(我);Kd1 = current_position(我);
Kp2 = current_position(我);Ki2 = current_position(我);我Kd2 = current_position(6日);
Kp3 = current_position(7,我);我Ki3 = current_position(8日);我Kd3 = current_position(9日);
我lam1 = current_position(10日);mu1 = current_position(11,我);
我lam2 = current_position(12日);我mu2 = current_position(13日);
我lam3 = current_position(14日);mu3 = current_position(15,我);
simopt = simset (“规划求解”,“数值”);%初始化sim选项
[xout吹捧,你]= sim卡(“模型”100年[0],simopt);
F =总和(e2);
current_fitness (i) = F;
结束
local_best_fitness = current_fitness;
[global_best_fitness g] = min (local_best_fitness);
i = 1: n
globl_best_position(:,我)= local_best_position (:, g);
结束
% - - - - - - - - - - - - - - - - - - - %
%的速度更新%
% - - - - - - - - - - - - - - - - - - - %
速度= w *速度+ c1 * (R1。* (local_best_position-current_position)) + c2 * (R2。* (globl_best_position-current_position));
% - - - - - - - - - - - - - - - - - - %
% SWARMUPDATE %
% - - - - - - - - - - - - - - - - - - %
current_position = current_position +速度;
i = 1: n
j = 1: n
如果current_position (i, j) > 1
current_position (i, j) = 1;
elseifcurrent_position (i, j) < 0
current_position (i, j) = 0;
结束
结束
结束
% - - - - - - - - - - - - - - - - - - - - - - - - %
%重新评估群%
% - - - - - - - - - - - - - - - - - - - - - - - - %
% %主循环
iter = 0;%的迭代'counter
(iter < bird_setp)
iter = iter + 1;
i = 1: n
Kp1 = current_position (1,);Ki1 = current_position(我);Kd1 = current_position(我);
Kp2 = current_position (1,);Ki2 = current_position(我);Kd2 = current_position(我);
Kp3 = current_position (1,);Ki3 = current_position(我);Kd3 = current_position(我);
我lam1 = current_position(10日);mu1 = current_position(11,我);
我lam2 = current_position(12日);我mu2 = current_position(13日);
我lam3 = current_position(14日);mu3 = current_position(15,我);
simopt = simset (“规划求解”,“数值”);%初始化sim选项
[xout吹捧,你]= sim卡(“模型”100年[0],simopt);
F =总和(e2);
current_fitness (i) = F;
结束
i = 1: n
如果current_fitness (i) < local_best_fitness(我)
local_best_fitness (i) = current_fitness(我);
local_best_position(:,我)= current_position(:,我);
结束
结束
[current_global_best_fitness g] = min (local_best_fitness);
如果current_global_best_fitness < global_best_fitness
global_best_fitness = current_global_best_fitness;
i = 1: n
globl_best_position(:,我)= local_best_position (:, g);
结束
结束
速度= w *速度+ c1 * (R1。* (local_best_position-current_position)) + c2 * (R2。* (globl_best_position-current_position));
current_position = current_position +速度;
i = 1: n
j = 1: n
如果current_position (i, j) > 1
current_position (i, j) = 1;
elseifcurrent_position (i, j) < 0
current_position (i, j) = 0;
结束
结束
结束
sprintf (交互影响的价值iter % 3.0 f 'iter)
结束%的while循环的结束意味着所有鸟类移动一步
xx =健身(:,3);
[Y,我]= min (xx);
current_position(:,我)
%

答案(0)

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!