187号资源-源程序:利用随机有限集理论对蜂群的ILQR和MPC控制------已提供下载资源

👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆下载资源链接👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆

《《《《《《《《更多资源还请持续关注本专栏》》》》》》》

论文与完整源程序_电网论文源程序的博客-CSDN博客icon-default.png?t=O83Ahttps://blog.csdn.net/liang674027206/category_12531414.html

电网论文源程序-CSDN博客电网论文源程序擅长文章解读,论文与完整源程序,等方面的知识,电网论文源程序关注python,机器学习,计算机视觉,深度学习,神经网络,数据挖掘领域.https://blog.csdn.net/LIANG674027206?type=download

蜂群控制是一种模仿自然界蜜蜂行为的智能体控制策略,用于协调和优化多个智能体的集体行为。在这项研究中,随机有限集理论被应用于控制算法,以处理蜂群系统中的不确定性和动态变化。

ILQR(Iterative Linear Quadratic Regulator)是一种迭代优化算法,用于解决线性二次调节问题,旨在优化系统的控制性能。MPC(Model Predictive Control)是一种基于预测模型的控制方法,通过实时优化来调整控制策略。将这两种算法与随机有限集理论结合,可以有效处理蜂群系统中由于环境变化、传感器噪声和智能体间相互作用带来的不确定性。 随机有限集理论提供了一种处理不确定性和随机性的框架,使得在复杂的蜂群系统中,ILQR和MPC能够更好地适应动态变化和实现优化控制。

总结来说,这种结合方法通过理论上的支持和算法上的创新,提升了蜂群系统在不确定环境中的协调性和控制精度。

部分代码展示:

function u_ctrl= CWH_dyn_example(x0,xdes,t,dt,size_ctrl)
%
% Function to find a good initial guess for ILQR using LQ integrater
%
% Synopsis:
%     u_ctrl= CWH_dyn_example(x0,xdes,t,dt,size_ctrl)
%
% Input:
%     x0          =   states for each density (# states x # densities)
%     xdes       =   target states (# target states x # target densities)
%     t           =  Simulation time for trajectory (vector)
%     dt          =  time-step for simulation
%     size_ctrl   =  size of the control input
%
% By: Bryce Doerr -- Aug. 2018

%Clohessy Wiltshire

%Size of densities
num_density=size(x0,2);

%Orbital Parameters
n=.00113;%ang freq
m=1;%kg

%Build Dynamical System for number of densities
Z= [0     0 0 1 0   0;...
    0     0 0 0 1   0;...
    0     0 0 0 0   1;...
    3*n^2 0 0 0 2*n  0;...
    0    0 0 -2*n 0 0;...
    0 0 -n^2 0 0 0;]; %build the A matrix
A=kron(eye(size(x0,2)),Z);
W=[0 0 0; 0 0 0; 0 0 0; 1/m 0 0; 0 1/m 0; 0 0 1/m;];%build the B matrix
Br=repmat(W,1,size(x0,2));
Bc=mat2cell(Br, size(W,1),repmat(size(W,2),1,size(x0,2)));
B=blkdiag(Bc{:});
V=[1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 1 0 0 0]; %Build C matrix
Cr=repmat(V,1,size(x0,2));
Cc=mat2cell(Cr, size(V,1),repmat(size(V,2),1,size(x0,2)));
C=blkdiag(Cc{:});
D=zeros(length(A)/2,size(B,2));
sys=ss(A,B,C,D);

%% Discrete
sys_d=c2d(sys, dt);
A=sys_d.A;
B=sys_d.B;
C=sys_d.C;
D=sys_d.D;

%% Initialize Control
ushape=zeros(1,size_ctrl*size(x0,2));
u=repmat(ushape,length(t),1)';
u_ctrl=u;


%% LQR Response
x_ctrl=zeros(length(A),length(t));
x_ctrl(:,1)=reshape(x0,[],1);
xi=zeros(length(A)/2,length(t));
y=zeros(length(A)/2,length(t));

%LQR weights
Q=1*eye(size(A,1)+size(C,1));
R=.0000008*eye(3*size(x0,2));

%Find K Gains using LQI
K=lqi(sys_d,Q,R);

%Initialize Reference
r=xdes;
r(4:6,:,:)=[];

%Simulate
for i=1:length(t)-1
    u_ctrl(:,i)=-K*[x_ctrl(:,i);xi(:,i)];
    x_ctrl(:,i+1)=A*x_ctrl(:,i)+B*u_ctrl(:,i);
    y(:,i)=C*x_ctrl(:,i)+D*u_ctrl(:,i);
    
    xi(:,i+1)=xi(:,i)+dt*(reshape(r(:,:,i),[],1)-y(:,i));
end

%Plot Figures
figure
hold on;
xlim([-5 5]);
ylim([-5 5]);
for i=1:num_density
    plot(x_ctrl(6*i-5,:),x_ctrl(6*i-4,:))
    plot(x_ctrl(6*i-5,1),x_ctrl(6*i-4,1),'or');
    plot(x_ctrl(6*i-5,end),x_ctrl(6*i-4,end),'*g');
end
plot(xdes(1,:),xdes(2,:),'xb')
xlabel('X')
ylabel('Y')
xlim([-15 15]);
ylim([-15 15]);

figure
subplot(2,2,1);
hold on;
for i=1:num_density
    plot(x_ctrl(6*i-5,1),x_ctrl(6*i-4,1),'or');
end
xlabel('x')
ylabel('y')
title('time = 0 s')
grid on;
for i=1:num_density
    plot(xdes(1,i,1),xdes(2,i,1),'xk','LineWidth',2)
end
xlim([-15 15]);
ylim([-15 15]);

subplot(2,2,2);
hold on;
for i=1:num_density
    plot(x_ctrl(6*i-5,16),x_ctrl(6*i-4,16),'or');
end
xlabel('x')
ylabel('y')
title('time = 15 s')
grid on;
for i=1:num_density
    plot(xdes(1,i,16),xdes(2,i,16),'xk','LineWidth',2)
end
xlim([-15 15]);
ylim([-15 15]);

subplot(2,2,3);
hold on;
for i=1:num_density
    plot(x_ctrl(6*i-5,31),x_ctrl(6*i-4,31),'or');
end
xlabel('x')
ylabel('y')
title('time = 30 s')
grid on;
for i=1:num_density
    plot(xdes(1,i,31),xdes(2,i,31),'xk','LineWidth',2)
end
xlim([-15 15]);
ylim([-15 15]);

subplot(2,2,4);
hold on;
for i=1:num_density
    plot(x_ctrl(6*i-5,41),x_ctrl(6*i-4,41),'or');
end
xlabel('x')
ylabel('y')
title('time = 40 s')
grid on;
for i=1:num_density
    plot(xdes(1,i,41),xdes(2,i,41),'xk','LineWidth',2)
end
xlim([-15 15]);
ylim([-15 15]);

效果展示:

187号资源-源程序:利用随机有限集理论对蜂群的ILQR和MPC控制-本人博客有解读资源-CSDN文库icon-default.png?t=O83Ahttps://download.csdn.net/download/LIANG674027206/89761845👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆下载资源链接👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆

《《《《《《《《更多资源还请持续关注本专栏》》》》》》》

论文与完整源程序_电网论文源程序的博客-CSDN博客icon-default.png?t=O83Ahttps://blog.csdn.net/liang674027206/category_12531414.html

电网论文源程序-CSDN博客电网论文源程序擅长文章解读,论文与完整源程序,等方面的知识,电网论文源程序关注python,机器学习,计算机视觉,深度学习,神经网络,数据挖掘领域.https://blog.csdn.net/LIANG674027206?type=download

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

电网论文源程序

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值