function varargout = AntColonyVRPGUI(varargin)
% ANTCOLONYVRPGUI M-file for AntColonyVRPGUI.fig
% ANTCOLONYVRPGUI, by itself, creates a new ANTCOLONYVRPGUI or raises the existing
% singleton*.
%
% H = ANTCOLONYVRPGUI returns the handle to a new ANTCOLONYVRPGUI or the handle to
% the existing singleton*.
%
% ANTCOLONYVRPGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in ANTCOLONYVRPGUI.M with the given input arguments.
%
% ANTCOLONYVRPGUI('Property','Value',...) creates a new ANTCOLONYVRPGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before AntColonyVRPGUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to AntColonyVRPGUI_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 AntColonyVRPGUI
% Last Modified by GUIDE v2.5 11-Jun-2015 00:13:48
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @AntColonyVRPGUI_OpeningFcn, ...
'gui_OutputFcn', @AntColonyVRPGUI_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 AntColonyVRPGUI is made visible.
function AntColonyVRPGUI_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 AntColonyVRPGUI (see VARARGIN)
% Choose default command line output for AntColonyVRPGUI
handles.output = hObject;
%% change !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
handles.ismdvrp = true; %!!!
%%
if handles.ismdvrp == true
[handles.initClusters, handles.coordinates] = INIT;
handles.clusters = handles.initClusters;
set(handles.uipanelBases,'Visible','on');
create_init_plot_MDVRP(handles.coordinates, handles.clusters);
else
%initialization
[vehicles,demands,dist_stations,dist_bases] = INIT_VRP;
handles.vehicles = vehicles;
handles.demands = demands;
handles.distances_stations = dist_stations;
handles.distances_bases = dist_bases;
set(handles.uipanelBases,'Visible','off');
end
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes AntColonyVRPGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = AntColonyVRPGUI_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 algorithmPopupmenu.
function algorithmPopupmenu_Callback(hObject, eventdata, handles)
% hObject handle to algorithmPopupmenu (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 algorithmPopupmenu contents as cell array
% contents{get(hObject,'Value')} returns selected item from algorithmPopupmenu
%set invisible error messages
set(handles.errorMandatoryEditFields,'Visible','off');
%erase text in edit fields
set(handles.evaporationPheromoneEdit,'String','');
set(handles.attractStationEdit,'String','');
set(handles.increasePheromoneEdit,'String','');
set(handles.amountPheromoneEdit,'String','');
set(handles.eliteAntsEdit,'String','');
%set disabled all edit fields
set(handles.evaporationPheromoneEdit,'Enable','off');
set(handles.attractStationEdit,'Enable','off');
set(handles.increasePheromoneEdit,'Enable','off');
set(handles.amountPheromoneEdit,'Enable','off');
set(handles.eliteAntsEdit,'Enable','off');
%set disabled run button
set(handles.runButton,'Enable','off');
%set to 0 all results
set(handles.lengthWayText,'String','-');
set(handles.subroutesNText,'String','-');
set(handles.timeSpentText,'String','-');
if handles.ismdvrp == true
%set invisible bases' listbox
set(handles.listboxBases,'Visible','off');
set(handles.totalLengthText,'Visible','off');
set(handles.totalLengthText,'String','-');
set(handles.totalLengthLabel,'Visible','off');
%clear plot
cla;
create_init_plot_MDVRP(handles.coordinates, handles.clusters);
end
%clear plot
%cla;
%clear legend
legend('off');
val = get(hObject,'Value');
if val ~= 1 %not placeholder's text (not be executed)
if val ~= 2 %not Clark-Wright algorithm
%enable edit fields
if val == 5 %AntAlg with elite ants
set(handles.eliteAntsEdit,'Enable','on');
end
set(handles.evaporationPheromoneEdit,'Enable','on');
set(handles.attractStationEdit,'Enable','on');
set(handles.increasePheromoneEdit,'Enable','on');
set(handles.amountPheromoneEdit,'Enable','on');
end
%enable run button
set(handles.runButton,'Enable','on');
end
% --- Executes during object creation, after setting all properties.
function algorithmPopupmenu_CreateFcn(hObject, eventdata, handles)
% hObject handle to algorithmPopupmenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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
function evaporationPheromoneEdit_Callback(hObject, eventdata, handles)
% hObject handle to evaporationPheromoneEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of evaporationPheromoneEdit as text
% str2double(get(hObject,'String')) returns contents of evaporationPheromoneEdit as a double
% --- Executes during object creation, after setting all properties.
function evaporationPheromoneEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to evaporationPheromoneEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit 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
function attractStationEdit_Callback(hObject, eventdata, handles)
% hObject handle to attractStationEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of attractStationEdit as text
% str2double(get(hObject,'String')) returns contents of attractStationEdit as a double
% --- Executes during object creation, after setting
没有合适的资源?快使用搜索试试~ 我知道了~
【VRP】基于matlab蚁群算法求解多中心的车辆路径规划问题【含Matlab源码 111期】.zip
共31个文件
m:27个
fig:2个
log:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 2 下载量 45 浏览量
2023-11-05
18:23:47
上传
评论 1
收藏 143KB ZIP 举报
温馨提示
CSDN海神之光上传的代码均可运行,亲测可用,直接替换数据即可,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描博客文章底部QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
资源推荐
资源详情
资源评论
收起资源包目录
【VRP】基于matlab蚁群算法求解多中心的车辆路径规划问题【含Matlab源码 111期】.zip (31个子文件)
【VRP】基于matlab蚁群算法求解多中心的车辆路径规划问题【含Matlab源码 111期】
create_plot_route_with_vehicles_MDVRP.m 2KB
About.fig 5KB
create_init_plot_MDVRP.m 1KB
vehicles_capacities_to_cellarray.m 214B
create_demands.m 417B
mccExcludedFiles.log 0B
equal_coord.m 209B
create_vehicles.m 212B
create_savings.m 381B
create_distances_and_savings.m 496B
ANT_colony_algorithm_minpath.m 5KB
ANT_colony_algorithm_VRP_with_elite_ants.m 10KB
ANT_colony_algorithm_VRP_with_savings.m 7KB
stats_with_markers.m 973B
INIT.m 3KB
from_coordinates_to_distances.m 457B
img
university_logo.jpg 80KB
ANT_colony_algorithm_VRP.m 9KB
About.m 3KB
create_plot_route.m 932B
add_bases_to_distances.m 175B
AntColonyVRPGUI.m 23KB
delete_duplicates_stations.m 349B
create_distances.m 2KB
create_plot_of_base_MDVRP.m 3KB
number_of_subroutes.m 354B
AntColonyVRPGUI.fig 14KB
Clark_Wright_VRP.m 13KB
INIT_VRP.m 507B
create_plot_route_with_vehicles.m 2KB
ANT_colony_algorithm_VRP_minpath.m 9KB
共 31 条
- 1
资源评论
- 刘丽星2023-12-16资源很实用,内容详细,值得借鉴的内容很多,感谢分享。
- csdd1235622023-12-21资源很受用,资源主总结的很全面,内容与描述一致,解决了我当下的问题。
海神之光
- 粉丝: 5w+
- 资源: 6110
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功