Advertisement

《蚁群算法原理及其应用》(段海滨)附录Matlab源程序

阅读量:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Function: Open and import file of city coordinates in TSP %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[fname,pname,filterindex]=uigetfile('.','All Files (.)');
set(handles.text_filename,'String',filename);
fid=fopen(filename,'r');
if fid==-1
warndlg('Can not open the file','WARN');
fclose(fid);
end
[citymat,COUNT]=fscanf(fid,' %g');
cN=COUNT/3;
set(handles.edit_citysum,'String',cN);
fclose(fid);
aN=str2double(get(handles.edit_antsum,'String'));
ncmax=str2double(get(handles.edit_ncmax,'String'));
for nc=1:ncmax
for k=1:a

全部评论 (0)

还没有任何评论哟~