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 varargout = main_GUI_xu(varargin)
% MAIN_GUI_XU MATLAB code for main_GUI_xu.fig
%      MAIN_GUI_XU, by itself, creates a new MAIN_GUI_XU or raises the existing
%      singleton*.
%
%      H = MAIN_GUI_XU returns the handle to a new MAIN_GUI_XU or the handle to
%      the existing singleton*.
%
%      MAIN_GUI_XU('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MAIN_GUI_XU.M with the given input arguments.
%
%      MAIN_GUI_XU('Property'.'Value',...). creates anew MAIN_GUI_XU or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before main_GUI_xu_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to main_GUI_xu_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help main_GUI_xu

% Last Modified by GUIDE v2. 5 22-Mar- 2017. 15:58:57

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @main_GUI_xu_OpeningFcn, ...
                   'gui_OutputFcn',  @main_GUI_xu_OutputFcn, ...
                   'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before main_GUI_xu is made visible.
function main_GUI_xu_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to main_GUI_xu (see VARARGIN)

% Choose default command line output for main_GUI_xu
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes main_GUI_xu wait for user response (see UIRESUME)
% uiwait(handles.figure1);
init_all(handles)
set(handles.edit38,'string'.'First choose the purpose of the experiment, and by default choose purpose one, which is to run an algorithm.');

% --- Outputs from this function are returned to the command line.
function varargout = main_GUI_xu_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1


% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0.'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor'.'white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)Draw the raster line and call the global barrier pushButton1_userData screen callback function for Figure= 1; % controls whether the design obstacle button can be usedset(handles.edit38,'string'.'After the completion of the obstacle design, please click the output obstacle button, otherwise it is easy to make mistakes');
axes(handles.axes1)
cla reset
n_barrier = str2double(get(handles.edit1,'string'));
barrier = zeros(n_barrier,n_barrier);
axes(handles.axes1);
s.hf = get(handles.axes1,'parent'); Draws grid edgesfor i=0:1:n_barrier
    plot([0,n_barrier],[i,i],'color'.'k');
    hold on
    axis([0,n_barrier,0,n_barrier])
    for j=0:1:n_barrier
        plot([i,i],[0,n_barrier],'color'.'k') ;
        hold on
        axis([0,n_barrier,0,n_barrier])End end % sets the WindowButtonDownFcn property of figureset(s.hf,'WindowButtonDownFcn',@figure1_windowbuttondownfcn)


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
global barrier_select start_select goal_select pushbutton1_userdata barrier start goal
barrier_value = get(handles.popupmenu1,'value');
cd('barrier')
if barrier_value==2
    barrier_select = xlsread('e_barrier');
    start_select = 20;
    goal_select = 295;
    pushbutton1_userdata = 0;
elseif barrier_value==3
    barrier_select = xlsread('simple_e');
    start_select = 20;
    goal_select = 295;
    pushbutton1_userdata = 0;
elseif barrier_value==4
    barrier_select = xlsread('u_barrier');
    start_select = 1;
    goal_select = 400;
    pushbutton1_userdata = 0;
elseif barrier_value==5
    barrier_select = xlsread('light_u_barrier');
    start_select = 1;
    goal_select = 400;
    pushbutton1_userdata = 0;
elseif barrier_value==6
    barrier_select = xlsread('right_u_barrier');
    start_select = 1;
    goal_select = 400;
    pushbutton1_userdata = 0;
elseif barrier_value==7
    barrier_select = xlsread('z_barrier');
    start_select = 49;
    goal_select = 369;
    pushbutton1_userdata = 0;
elseif barrier_value==8
    barrier_select = xlsread('complex_z');
    start_select = 47;
    goal_select = 367;
    pushbutton1_userdata = 0;
elseif barrier_value==9
    barrier_select = xlsread('complex_1');
    start_select = 1;
    goal_select = 400;
    pushbutton1_userdata = 0;
elseif barrier_value==10
    barrier_select = xlsread('complex_2');
    start_select = 1;
    goal_select = 400;
    pushbutton1_userdata = 0;
elseif barrier_value==11
    barrier_select = xlsread('complex_30');
    start_select = 1;
    goal_select = 890;
    pushbutton1_userdata = 0;
elseif barrier_value==12
    barrier_select = xlsread('complex_50_1');
    start_select = 1;
    goal_select = 2500;
elseif barrier_value==13
    barrier_select = xlsread('complex_50_2');
    start_select = 1;
    goal_select = 2500;
    pushbutton1_userdata = 0;
elseif barrier_value==14
    barrier_select = xlsread('complex_50_3');
    start_select = 1;
    goal_select = 2500;
    pushbutton1_userdata = 0;
elseif barrier_value==15
    barrier_select = xlsread('barrier_tmp');
    set(handles.edit18,'string'.'Please select starting point and ending point')
    pushbutton1_userdata = 0;
    start = 0;
    goal = 0;
end
Copy the code

3. Operation results



Fourth, note

Version: 2014 a