A list,
1. Ant colony algorithm is proposed
Ant Colony Optimization algorithm (ACO), also known as ant algorithm, is a probabilistic algorithm used to find optimal paths. It was proposed by Marco Dorigo in his PhD thesis in 1992 and was inspired by the behavior of ants in finding their way to food. Genetic algorithm has been applied in pattern recognition, neural network, machine learning, industrial optimal control, adaptive control, biological science, social science and so on.
2. Basic principles of the algorithm
Ii. Source code
function [sys,x0,str,ts] = quadrotor_plot(t,x,u,flag,s,plot,enable,vehicle)
ts = [- 1 0];
if ~isfield(vehicle, 'nrotors')
vehicle.nrotors = 4; % sensible default for quadrotor function
end
switch flag,
case 0
[sys,x0,str,ts] = mdlInitializeSizes(ts,plot,enable); % Initialization
case 3
sys = mdlOutputs(t,u,s,plot,enable, vehicle); % Calculate outputs
case {1.2.4.9} % Unused flags
sys = [];
otherwise
error(['unhandled flag = ',num2str(flag)]); % Error handling
end
% Initialize
function [sys,x0,str,ts] = mdlInitializeSizes(ts,plot,enable)
% Call simsizes for a sizes structure, fill it in, and convert it
% to a sizes array.
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 0;
sizes.NumInputs = 6;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [];
str = []; % Set str to an empty matrix.
ts = [0.05 0];
if enable == 1
figure(plot);
clf;
%colordef(1.'none');
end
% End of mdlInitializeSizes.
function sys = mdlOutputs(t,u,s, plot, enable, quad)
global a1s b1s
% not quite sure what this is about -- PIC
if numel(a1s) == [0];
a1s = zeros(1, quad.nrotors);
b1s = zeros(1, quad.nrotors);
end
% vehicle dimensons
d = quad.d; %Hub displacement from COG
r = quad.r; %Rotor radius
for i = 1:quad.nrotors
theta = (i- 1)/quad.nrotors*2*pi;
% Di Rotor hub displacements (1x3)
D(:,i) = [ d*cos(theta); d*sin(theta); 0];
scal = s(1) /4;
%Attitude center displacements
C(:,i) = [ scal*cos(theta); scal*sin(theta); 0];
end
Copy the code
3. Operation results
Fourth, note
Version: 2014 a