当前位置:   article > 正文

【路径规划】基于蚁群算法栅格地图路径规划matlab_基于matlab蚁群算法的栅格图的路径规划

基于matlab蚁群算法的栅格图的路径规划

路径规划是实现移动机器人自主导航的关键技术,是指在有障碍物的环境中,按照一定的评价标准(如距离、时间、能耗等),寻找到一条从起始点到目标点的无碰撞路径,这里选取最短距离路径规划的评价标准,即最短路径规划问题。

1.路径规划数学模型的建立

将移动机器人周围环境用一组数据进行抽象表达,建立二维或三维的环境模型,得到移动机器人能够理解分析的环境数据,是机器人路径规划的基本前提。我这里用的是栅格法,其原理是将周围环境看成一个二维平面,将平面分成一个个等面积大小的具有二值信息的栅格,每个栅格中存储着周围环境信息量,下图我给出了一个栅格法地图,方便大家更好的理解栅格地图。这里设计的栅格地图为一个20×20的地形矩阵,黑色的地方表示有障碍,白色的地方表示没有障碍。
我用MATLAB画的
图1 栅格法地图
在用栅格法建立环境模型时,为了将环境信息转换成移动机器人可以识别的数据,一般采用序号法标记环境地图信息,即将栅格地图中一个个栅格从序号1依次累加直到标记到最后一个栅格。如图2所示。
自己用Word画的
图2 序号法示意图
另外,对于一幅带有坐标的栅格图来说,每个栅格点有唯一的坐标,假设栅格规模为x行y列,第i个栅格对应的位置由式(1)所示。
公式截图
式中a为每个小方格像素的边长,ceil(n)取大于等于数值n的最小整数,mod(i,y)求i除以y的余数。
每条路径(从起点走到终点)的长度可以由式(2)计算得出。
公式截图
在解决环境建模之后,我们需要设计机器人移动的方法,这里我采用如图3所示的八叉树搜索策略,即机器人在搜索过程中可以朝附近八个方向的相邻栅格之间的自由移动。
Visio截图
图3 八叉树搜索策略
那么,怎么判断一个栅格点是否为另一个栅格点的相邻栅格点呢,另外,又怎么判断是否为有障碍栅格呢。这就需建立矩阵D,记录每个栅格点至其相邻栅格点的代价值。本例中栅格地图有20×20个栅格点,则D的大小为400×400,其中列是起点栅格,行是局部终点栅格,各栅格点至其各相邻无障碍栅格点的代价值非零,而有障碍栅格及非相邻栅格设为0。
这里需要说明的是,我的MATLAB程序来自于:
版权声明:本文为CSDN博主「qq_40443076」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_40443076/article/details/88179836
这里主要介绍基于蚁群算法的机器人最短路径规划的思路,以及我在运行MALTLAB程序的时候,学到的内容。

2.机器人最短路径规划的实现步骤

蚁周模型实现机器人最短路径规划的流程图

为了方便大家更好地理解蚁群算法的原理及实现过程,其流程图如图4所示。(流程图较长,我截图了两段。)
Visio 截图
Visio截图
图4 基于蚁群算法的机器人最小路径规划流程图
图中公式(3)(4)的具体表达在下边的具体步骤里。

蚁周模型实现机器人最短路径规划的具体步骤

**步骤1:**给出栅格地图的地形矩阵;初始化信息素矩阵 Tau(记录每个栅格至其他栅格的信息素量),最大迭代次数K,蚂蚁个数M,表征信息素重要程度的参数 、表征启发式信息重要程度的参数 ,信息素蒸发系数 ,信息素增加强度系数Q及启发式信息矩阵
**步骤2:**构建启发式信息矩阵。按式(1)和式(2)计算每个栅格至目标点的距离,启发式信息素取为至目标点距离的倒数,距离越短,启发式因子越大,障碍物处的启发式信息为0。建立矩阵D,用以存储每个栅格点至各自相邻无障碍栅格点的代价值。
**步骤3:**对于每一只蚂蚁,初始化蚂蚁爬行的路径及路径长度,将禁忌列表全部初始化为1;蚂蚁从起始点出发开始搜索路径,找出当前栅格点的所有无障碍相邻栅格点(即矩阵D中相应元素不为0的栅格点),再根据禁忌列表筛选出当前可选择的栅格点。
**步骤4:**如果起始点是目标点,且可选栅格点个数大于等于1,则根据式(3)计算蚂蚁从当前栅格点转移到各相邻栅格点的概率,
公式截图
并根据轮盘赌的方法选择下一个栅格点。
**步骤5:**更新蚂蚁爬行的路径、路径长度、矩阵D及禁忌列表。
**步骤6:**重复步骤4和5直到起始点为目标点或可选栅格点小于1,本次迭代中当前蚂蚁寻路完毕,记录该蚂蚁的行走路线。
**步骤7:**如果该蚂蚁最后一步是目标点,则计算路径长度并与当前已知的最短路径长度作比较,若本次路径长度小于当前已知的最短路径长度,则更新当前最短路径长度及最短路径;如果该蚂蚁最后一步不是目标的,则只将路径长度记为0。
**步骤8:**重复步骤3至步骤7直到M只蚂蚁完成一轮路径搜索,按照式(4)更新信息素。
公式截图
**步骤9:**判断是否满足终止条件K,是结束蚁群算法寻优并绘制最优规划路径,否则转到步骤3。

  1. function varargout = main_GUI_xu(varargin)
  2. % MAIN_GUI_XU MATLAB code for main_GUI_xu.fig
  3. % MAIN_GUI_XU, by itself, creates a new MAIN_GUI_XU or raises the existing
  4. % singleton*.
  5. %
  6. % H = MAIN_GUI_XU returns the handle to a new MAIN_GUI_XU or the handle to
  7. % the existing singleton*.
  8. %
  9. % MAIN_GUI_XU('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in MAIN_GUI_XU.M with the given input arguments.
  11. %
  12. % MAIN_GUI_XU('Property','Value',...) creates a new MAIN_GUI_XU or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before main_GUI_xu_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to main_GUI_xu_OpeningFcn via varargin.
  17. %
  18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  19. % instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22. % Edit the above text to modify the response to help main_GUI_xu
  23. % Last Modified by GUIDE v2.5 22-Mar-2017 15:58:57
  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton', gui_Singleton, ...
  28. 'gui_OpeningFcn', @main_GUI_xu_OpeningFcn, ...
  29. 'gui_OutputFcn', @main_GUI_xu_OutputFcn, ...
  30. 'gui_LayoutFcn', [] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end
  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT
  41. % --- Executes just before main_GUI_xu is made visible.
  42. function main_GUI_xu_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdata reserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to main_GUI_xu (see VARARGIN)
  48. % Choose default command line output for main_GUI_xu
  49. handles.output = hObject;
  50. % Update handles structure
  51. guidata(hObject, handles);
  52. % UIWAIT makes main_GUI_xu wait for user response (see UIRESUME)
  53. % uiwait(handles.figure1);
  54. init_all(handles)
  55. set(handles.edit38,'string','先选择实验目的,默认选择目的一,即运行一种算法');
  56. % --- Outputs from this function are returned to the command line.
  57. function varargout = main_GUI_xu_OutputFcn(hObject, eventdata, handles)
  58. % varargout cell array for returning output args (see VARARGOUT);
  59. % hObject handle to figure
  60. % eventdata reserved - to be defined in a future version of MATLAB
  61. % handles structure with handles and user data (see GUIDATA)
  62. % Get default command line output from handles structure
  63. varargout{1} = handles.output;
  64. % --- Executes on selection change in listbox1.
  65. function listbox1_Callback(hObject, eventdata, handles)
  66. % hObject handle to listbox1 (see GCBO)
  67. % eventdata reserved - to be defined in a future version of MATLAB
  68. % handles structure with handles and user data (see GUIDATA)
  69. % Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
  70. % contents{get(hObject,'Value')} returns selected item from listbox1
  71. % --- Executes during object creation, after setting all properties.
  72. function listbox1_CreateFcn(hObject, eventdata, handles)
  73. % hObject handle to listbox1 (see GCBO)
  74. % eventdata reserved - to be defined in a future version of MATLAB
  75. % handles empty - handles not created until after all CreateFcns called
  76. % Hint: listbox controls usually have a white background on Windows.
  77. % See ISPC and COMPUTER.
  78. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  79. set(hObject,'BackgroundColor','white');
  80. end
  81. % --- Executes on button press in pushbutton1.
  82. function pushbutton1_Callback(hObject, eventdata, handles)
  83. % hObject handle to pushbutton1 (see GCBO)
  84. % eventdata reserved - to be defined in a future version of MATLAB
  85. % handles structure with handles and user data (see GUIDATA)
  86. % 绘制栅格线和调用figure的屏幕回调函数
  87. global barrier pushbutton1_userdata
  88. pushbutton1_userdata = 1; % 控制设计障碍物按钮是否能够使用
  89. set(handles.edit38,'string','障碍物设计完成后,请点击输出障碍物按钮,否则容易出错');
  90. axes(handles.axes1)
  91. cla reset
  92. n_barrier = str2double(get(handles.edit1,'string'));
  93. barrier = zeros(n_barrier,n_barrier);
  94. axes(handles.axes1);
  95. s.hf = get(handles.axes1,'parent');
  96. % 绘制栅格边线
  97. for i=0:1:n_barrier
  98. plot([0,n_barrier],[i,i],'color','k');
  99. hold on
  100. axis([0,n_barrier,0,n_barrier])
  101. for j=0:1:n_barrier
  102. plot([i,i],[0,n_barrier],'color','k') ;
  103. hold on
  104. axis([0,n_barrier,0,n_barrier])
  105. end
  106. end
  107. % 设置figure的WindowButtonDownFcn属性
  108. set(s.hf,'WindowButtonDownFcn',@figure1_windowbuttondownfcn)
  109. % --- Executes on selection change in popupmenu1.
  110. function popupmenu1_Callback(hObject, eventdata, handles)
  111. % hObject handle to popupmenu1 (see GCBO)
  112. % eventdata reserved - to be defined in a future version of MATLAB
  113. % handles structure with handles and user data (see GUIDATA)
  114. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
  115. % contents{get(hObject,'Value')} returns selected item from popupmenu1
  116. global barrier_select start_select goal_select pushbutton1_userdata barrier start goal
  117. barrier_value = get(handles.popupmenu1,'value');
  118. cd('barrier')
  119. if barrier_value==2
  120. barrier_select = xlsread('e_barrier');
  121. start_select = 20;
  122. goal_select = 295;
  123. pushbutton1_userdata = 0;
  124. elseif barrier_value==3
  125. barrier_select = xlsread('simple_e');
  126. start_select = 20;
  127. goal_select = 295;
  128. pushbutton1_userdata = 0;
  129. elseif barrier_value==4
  130. barrier_select = xlsread('u_barrier');
  131. start_select = 1;
  132. goal_select = 400;
  133. pushbutton1_userdata = 0;
  134. elseif barrier_value==5
  135. barrier_select = xlsread('light_u_barrier');
  136. start_select = 1;
  137. goal_select = 400;
  138. pushbutton1_userdata = 0;
  139. elseif barrier_value==6
  140. barrier_select = xlsread('right_u_barrier');
  141. start_select = 1;
  142. goal_select = 400;
  143. pushbutton1_userdata = 0;
  144. elseif barrier_value==7
  145. barrier_select = xlsread('z_barrier');
  146. start_select = 49;
  147. goal_select = 369;
  148. pushbutton1_userdata = 0;
  149. elseif barrier_value==8
  150. barrier_select = xlsread('complex_z');
  151. start_select = 47;
  152. goal_select = 367;
  153. pushbutton1_userdata = 0;
  154. elseif barrier_value==9
  155. barrier_select = xlsread('complex_1');
  156. start_select = 1;
  157. goal_select = 400;
  158. pushbutton1_userdata = 0;
  159. elseif barrier_value==10
  160. barrier_select = xlsread('complex_2');
  161. start_select = 1;
  162. goal_select = 400;
  163. pushbutton1_userdata = 0;
  164. elseif barrier_value==11
  165. barrier_select = xlsread('complex_30');
  166. start_select = 1;
  167. goal_select = 890;
  168. pushbutton1_userdata = 0;
  169. elseif barrier_value==12
  170. barrier_select = xlsread('complex_50_1');
  171. start_select = 1;
  172. goal_select = 2500;
  173. elseif barrier_value==13
  174. barrier_select = xlsread('complex_50_2');
  175. start_select = 1;
  176. goal_select = 2500;
  177. pushbutton1_userdata = 0;
  178. elseif barrier_value==14
  179. barrier_select = xlsread('complex_50_3');
  180. start_select = 1;
  181. goal_select = 2500;
  182. pushbutton1_userdata = 0;
  183. elseif barrier_value==15
  184. barrier_select = xlsread('barrier_tmp');
  185. set(handles.edit18,'string','请选择起点和终点')
  186. pushbutton1_userdata = 0;
  187. start = 0;
  188. goal = 0;
  189. end
  190. cd ..
  191. X = size(barrier_select,1);
  192. Y = size(barrier_select,2);
  193. axes(handles.axes1);
  194. barrier = barrier_select;
  195. figure_barrier(barrier,handles);
  196. start = start_select;
  197. goal = goal_select;
  198. set(handles.edit2,'string',num2str(start) );
  199. set(handles.edit3,'string',num2str(goal) );
  200. % 画起点
  201. x_goal_new = ( mod(start-1,X) +1-0.5);
  202. y_goal_new = ( Y- ceil(start/Y) +1-0.5);
  203. x_start_floor = floor(x_goal_new);
  204. x_start_ceil = ceil(x_goal_new);
  205. y_start_floor = floor(y_goal_new);
  206. y_start_ceil = ceil(y_goal_new);
  207. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  208. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  209. fill(x_data,y_data,[0,1,0]);
  210. % 画终点
  211. x_goal_new = ( mod(goal-1,X) +1-0.5);
  212. y_goal_new = ( Y- ceil(goal/Y) +1-0.5);
  213. x_start_floor = floor(x_goal_new);
  214. x_start_ceil = ceil(x_goal_new);
  215. y_start_floor = floor(y_goal_new);
  216. y_start_ceil = ceil(y_goal_new);
  217. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  218. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  219. fill(x_data,y_data,[1,0,0]);
  220. % 设置通用参数
  221. num_ant = 2*X;
  222. set(handles.edit9,'string',num_ant);
  223. set(handles.edit10,'string',250);
  224. set(handles.edit18,'string',10)
  225. set(handles.axes2,'visible','on')
  226. % --- Executes during object creation, after setting all properties.
  227. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  228. % hObject handle to popupmenu1 (see GCBO)
  229. % eventdata reserved - to be defined in a future version of MATLAB
  230. % handles empty - handles not created until after all CreateFcns called
  231. % Hint: popupmenu controls usually have a white background on Windows.
  232. % See ISPC and COMPUTER.
  233. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  234. set(hObject,'BackgroundColor','white');
  235. end
  236. % --- Executes on button press in radiobutton1.
  237. function radiobutton1_Callback(hObject, eventdata, handles)
  238. % hObject handle to radiobutton1 (see GCBO)
  239. % eventdata reserved - to be defined in a future version of MATLAB
  240. % handles structure with handles and user data (see GUIDATA)
  241. % Hint: get(hObject,'Value') returns toggle state of radiobutton1
  242. set(handles.uipanel200,'visible','off')
  243. set(handles.uipanel201,'visible','off')
  244. set(handles.uipanel202,'visible','on')
  245. set(handles.uipanel203,'visible','off')
  246. set(handles.uipanel204,'visible','off')
  247. % --- Executes on button press in radiobutton2.
  248. function radiobutton2_Callback(hObject, eventdata, handles)
  249. % hObject handle to radiobutton2 (see GCBO)
  250. % eventdata reserved - to be defined in a future version of MATLAB
  251. % handles structure with handles and user data (see GUIDATA)
  252. % Hint: get(hObject,'Value') returns toggle state of radiobutton2
  253. set(handles.uipanel200,'visible','off')
  254. set(handles.uipanel201,'visible','on')
  255. set(handles.uipanel202,'visible','off')
  256. set(handles.uipanel203,'visible','off')
  257. set(handles.uipanel204,'visible','off')
  258. % --- Executes on button press in radiobutton3.
  259. function radiobutton3_Callback(hObject, eventdata, handles)
  260. % hObject handle to radiobutton3 (see GCBO)
  261. % eventdata reserved - to be defined in a future version of MATLAB
  262. % handles structure with handles and user data (see GUIDATA)
  263. % Hint: get(hObject,'Value') returns toggle state of radiobutton3
  264. function edit1_Callback(hObject, eventdata, handles)
  265. % hObject handle to edit1 (see GCBO)
  266. % eventdata reserved - to be defined in a future version of MATLAB
  267. % handles structure with handles and user data (see GUIDATA)
  268. % Hints: get(hObject,'String') returns contents of edit1 as text
  269. % str2double(get(hObject,'String')) returns contents of edit1 as a double
  270. % --- Executes during object creation, after setting all properties.
  271. function edit1_CreateFcn(hObject, eventdata, handles)
  272. % hObject handle to edit1 (see GCBO)
  273. % eventdata reserved - to be defined in a future version of MATLAB
  274. % handles empty - handles not created until after all CreateFcns called
  275. % Hint: edit controls usually have a white background on Windows.
  276. % See ISPC and COMPUTER.
  277. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  278. set(hObject,'BackgroundColor','white');
  279. end
  280. function edit2_Callback(hObject, eventdata, handles)
  281. % hObject handle to edit2 (see GCBO)
  282. % eventdata reserved - to be defined in a future version of MATLAB
  283. % handles structure with handles and user data (see GUIDATA)
  284. % Hints: get(hObject,'String') returns contents of edit2 as text
  285. % str2double(get(hObject,'String')) returns contents of edit2 as a double
  286. % --- Executes during object creation, after setting all properties.
  287. function edit2_CreateFcn(hObject, eventdata, handles)
  288. % hObject handle to edit2 (see GCBO)
  289. % eventdata reserved - to be defined in a future version of MATLAB
  290. % handles empty - handles not created until after all CreateFcns called
  291. % Hint: edit controls usually have a white background on Windows.
  292. % See ISPC and COMPUTER.
  293. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  294. set(hObject,'BackgroundColor','white');
  295. end
  296. function edit3_Callback(hObject, eventdata, handles)
  297. % hObject handle to edit3 (see GCBO)
  298. % eventdata reserved - to be defined in a future version of MATLAB
  299. % handles structure with handles and user data (see GUIDATA)
  300. % Hints: get(hObject,'String') returns contents of edit3 as text
  301. % str2double(get(hObject,'String')) returns contents of edit3 as a double
  302. % --- Executes during object creation, after setting all properties.
  303. function edit3_CreateFcn(hObject, eventdata, handles)
  304. % hObject handle to edit3 (see GCBO)
  305. % eventdata reserved - to be defined in a future version of MATLAB
  306. % handles empty - handles not created until after all CreateFcns called
  307. % Hint: edit controls usually have a white background on Windows.
  308. % See ISPC and COMPUTER.
  309. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  310. set(hObject,'BackgroundColor','white');
  311. end
  312. % --- Executes on button press in pushbutton2.
  313. function pushbutton2_Callback(hObject, eventdata, handles)
  314. % hObject handle to pushbutton2 (see GCBO)
  315. % eventdata reserved - to be defined in a future version of MATLAB
  316. % handles structure with handles and user data (see GUIDATA)
  317. % 鼠标取起点
  318. global permission_start
  319. permission_start = 1;
  320. set(handles.edit2,'string',[]);
  321. set(handles.edit3,'string',[]);
  322. axes(handles.axes1);
  323. if permission_start==1
  324. set(handles.edit38,'string','选择起点结束后请点击结束按钮,否则易出错');
  325. s.hf = get(handles.axes1,'parent');
  326. set(s.hf,'WindowButtonDownFcn',@figure1_windowbuttondownfcn_point_start);
  327. end
  328. global start
  329. figure_start(start)
  330. function figure1_windowbuttondownfcn_point_start(hobj,event)
  331. global barrier
  332. X = size(barrier,1);
  333. Y = size(barrier,2);
  334. global permission_start
  335. if permission_start==1
  336. if strcmp(get(hobj,'SelectionType'),'normal')
  337. p = get(gca,'currentpoint'); % 取鼠标当前所在点的坐标
  338. x(1) = p(1);% 当前点的横坐标;
  339. x_ceil = ceil(x(1));
  340. y(1) = p(3);% 当前点的纵坐标
  341. y_ceil = ceil(y(1));
  342. point_start = [x_ceil,y_ceil];
  343. start_tmp = point_start(1) + ( Y-point_start(2) )*X;
  344. figure_start(start_tmp);
  345. end
  346. end
  347. % 画出起点函数
  348. function figure_start(start_new)
  349. global barrier start
  350. if start_new~=start
  351. X = size(barrier,1);
  352. Y = size(barrier,2);
  353. % 清除以前的点的消息
  354. x_start = ( mod(start-1,X) +1-0.5);
  355. y_start = ( Y- ceil(start/Y) +1-0.5);
  356. x_start_floor = floor(x_start);
  357. x_start_ceil = ceil(x_start);
  358. y_start_floor = floor(y_start);
  359. y_start_ceil = ceil(y_start);
  360. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  361. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  362. fill(x_data,y_data,[1,1,1]);
  363. %% 画新的点
  364. x_start_new = ( mod(start_new-1,X) +1-0.5);
  365. y_start_new = ( Y- ceil(start_new/Y) +1-0.5);
  366. x_start_floor = floor(x_start_new);
  367. x_start_ceil = ceil(x_start_new);
  368. y_start_floor = floor(y_start_new);
  369. y_start_ceil = ceil(y_start_new);
  370. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  371. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  372. fill(x_data,y_data,[0,1,0]);
  373. start = start_new;
  374. data = '起点是%4.0f\n';
  375. fprintf(data,start)
  376. % set(handles.edit2,'string',start)
  377. end
  378. % function test(hObject, eventdata, handles)
  379. % global start start_new
  380. % if start~=start_new
  381. % set(hanles.edit2,'value',start_new)
  382. % end
  383. % 画终点的函数
  384. function figure_goal(goal_new)
  385. global barrier goal
  386. if goal_new~=goal
  387. X = size(barrier,1);
  388. Y = size(barrier,2);
  389. % 清除以前的点的消息
  390. x_goal = ( mod(goal-1,X) +1-0.5);
  391. y_goal = ( Y- ceil(goal/Y) +1-0.5);
  392. x_start_floor = floor(x_goal);
  393. x_start_ceil = ceil(x_goal);
  394. y_start_floor = floor(y_goal);
  395. y_start_ceil = ceil(y_goal);
  396. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  397. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  398. fill(x_data,y_data,[1,1,1]);
  399. %% 画新的点
  400. x_goal_new = ( mod(goal_new-1,X) +1-0.5);
  401. y_goal_new = ( Y- ceil(goal_new/Y) +1-0.5);
  402. x_start_floor = floor(x_goal_new);
  403. x_start_ceil = ceil(x_goal_new);
  404. y_start_floor = floor(y_goal_new);
  405. y_start_ceil = ceil(y_goal_new);
  406. x_data = [x_start_floor,x_start_ceil,x_start_ceil,x_start_floor];
  407. y_data = [y_start_floor,y_start_floor,y_start_ceil,y_start_ceil];
  408. fill(x_data,y_data,[1,0,0]);
  409. goal = goal_new;
  410. end
  411. % --- Executes on button press in pushbutton3.
  412. function pushbutton3_Callback(hObject, eventdata, handles)
  413. % hObject handle to pushbutton3 (see GCBO)
  414. % eventdata reserved - to be defined in a future version of MATLAB
  415. % handles structure with handles and user data (see GUIDATA)
  416. % 画终点
  417. global permission_goal
  418. permission_goal = 1;
  419. set(handles.edit2,'string',[])
  420. set(handles.edit3,'string',[])
  421. axes(handles.axes1);
  422. if permission_goal==1
  423. set(handles.edit38,'string','选择起点结束后请点击结束按钮,否则易出错');
  424. s.hf = get(handles.axes1,'parent');
  425. set(s.hf,'WindowButtonDownFcn',@figure1_windowbuttondownfcn_point_goal);
  426. end
  427. global goal
  428. figure_goal(goal);
  429. function figure1_windowbuttondownfcn_point_goal(hobj,event)
  430. global barrier
  431. X = size(barrier,1);
  432. Y = size(barrier,2);
  433. global permission_goal
  434. if permission_goal==1
  435. if strcmp(get(hobj,'SelectionType'),'normal')
  436. p = get(gca,'currentpoint'); % 取鼠标当前所在点的坐标
  437. x(1) = p(1);% 当前点的横坐标;
  438. x_ceil = ceil(x(1));
  439. y(1) = p(3);% 当前点的纵坐标
  440. y_ceil = ceil(y(1));
  441. point_goal = [x_ceil,y_ceil];
  442. goal = point_goal(1) + ( Y-point_goal(2) )*X;
  443. figure_goal(goal);
  444. data = '终点是%4.0f\n';
  445. fprintf(data,goal)
  446. end
  447. end
  448. function edit5_Callback(hObject, eventdata, handles)
  449. % hObject handle to edit201 (see GCBO)
  450. % eventdata reserved - to be defined in a future version of MATLAB
  451. % handles structure with handles and user data (see GUIDATA)
  452. % Hints: get(hObject,'String') returns contents of edit201 as text
  453. % str2double(get(hObject,'String')) returns contents of edit201 as a double
  454. % --- Executes during object creation, after setting all properties.
  455. function edit5_CreateFcn(hObject, eventdata, handles)
  456. % hObject handle to edit201 (see GCBO)
  457. % eventdata reserved - to be defined in a future version of MATLAB
  458. % handles empty - handles not created until after all CreateFcns called
  459. % Hint: edit controls usually have a white background on Windows.
  460. % See ISPC and COMPUTER.
  461. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  462. set(hObject,'BackgroundColor','white');
  463. end
  464. function edit6_Callback(hObject, eventdata, handles)
  465. % hObject handle to edit202 (see GCBO)
  466. % eventdata reserved - to be defined in a future version of MATLAB
  467. % handles structure with handles and user data (see GUIDATA)
  468. % Hints: get(hObject,'String') returns contents of edit202 as text
  469. % str2double(get(hObject,'String')) returns contents of edit202 as a double
  470. % --- Executes during object creation, after setting all properties.
  471. function edit6_CreateFcn(hObject, eventdata, handles)
  472. % hObject handle to edit202 (see GCBO)
  473. % eventdata reserved - to be defined in a future version of MATLAB
  474. % handles empty - handles not created until after all CreateFcns called
  475. % Hint: edit controls usually have a white background on Windows.
  476. % See ISPC and COMPUTER.
  477. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  478. set(hObject,'BackgroundColor','white');
  479. end
  480. function edit7_Callback(hObject, eventdata, handles)
  481. % hObject handle to edit203 (see GCBO)
  482. % eventdata reserved - to be defined in a future version of MATLAB
  483. % handles structure with handles and user data (see GUIDATA)
  484. % Hints: get(hObject,'String') returns contents of edit203 as text
  485. % str2double(get(hObject,'String')) returns contents of edit203 as a double
  486. % --- Executes during object creation, after setting all properties.
  487. function edit7_CreateFcn(hObject, eventdata, handles)
  488. % hObject handle to edit203 (see GCBO)
  489. % eventdata reserved - to be defined in a future version of MATLAB
  490. % handles empty - handles not created until after all CreateFcns called
  491. % Hint: edit controls usually have a white background on Windows.
  492. % See ISPC and COMPUTER.
  493. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  494. set(hObject,'BackgroundColor','white');
  495. end
  496. function edit8_Callback(hObject, eventdata, handles)
  497. % hObject handle to edit204 (see GCBO)
  498. % eventdata reserved - to be defined in a future version of MATLAB
  499. % handles structure with handles and user data (see GUIDATA)
  500. % Hints: get(hObject,'String') returns contents of edit204 as text
  501. % str2double(get(hObject,'String')) returns contents of edit204 as a double
  502. % --- Executes during object creation, after setting all properties.
  503. function edit8_CreateFcn(hObject, eventdata, handles)
  504. % hObject handle to edit204 (see GCBO)
  505. % eventdata reserved - to be defined in a future version of MATLAB
  506. % handles empty - handles not created until after all CreateFcns called
  507. % Hint: edit controls usually have a white background on Windows.
  508. % See ISPC and COMPUTER.
  509. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  510. set(hObject,'BackgroundColor','white');
  511. end
  512. function edit9_Callback(hObject, eventdata, handles)
  513. % hObject handle to edit9 (see GCBO)
  514. % eventdata reserved - to be defined in a future version of MATLAB
  515. % handles structure with handles and user data (see GUIDATA)
  516. % Hints: get(hObject,'String') returns contents of edit9 as text
  517. % str2double(get(hObject,'String')) returns contents of edit9 as a double
  518. % --- Executes during object creation, after setting all properties.
  519. function edit9_CreateFcn(hObject, eventdata, handles)
  520. % hObject handle to edit9 (see GCBO)
  521. % eventdata reserved - to be defined in a future version of MATLAB
  522. % handles empty - handles not created until after all CreateFcns called
  523. % Hint: edit controls usually have a white background on Windows.
  524. % See ISPC and COMPUTER.
  525. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  526. set(hObject,'BackgroundColor','white');
  527. end
  528. function edit10_Callback(hObject, eventdata, handles)
  529. % hObject handle to edit10 (see GCBO)
  530. % eventdata reserved - to be defined in a future version of MATLAB
  531. % handles structure with handles and user data (see GUIDATA)
  532. % Hints: get(hObject,'String') returns contents of edit10 as text
  533. % str2double(get(hObject,'String')) returns contents of edit10 as a double
  534. % --- Executes during object creation, after setting all properties.
  535. function edit10_CreateFcn(hObject, eventdata, handles)
  536. % hObject handle to edit10 (see GCBO)
  537. % eventdata reserved - to be defined in a future version of MATLAB
  538. % handles empty - handles not created until after all CreateFcns called
  539. % Hint: edit controls usually have a white background on Windows.
  540. % See ISPC and COMPUTER.
  541. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  542. set(hObject,'BackgroundColor','white');
  543. end
  544. % --- Executes on button press in radiobutton4.
  545. function radiobutton4_Callback(hObject, eventdata, handles)
  546. % hObject handle to radiobutton4 (see GCBO)
  547. % eventdata reserved - to be defined in a future version of MATLAB
  548. % handles structure with handles and user data (see GUIDATA)
  549. % Hint: get(hObject,'Value') returns toggle state of radiobutton4
  550. % --- Executes on button press in pushbutton4.
  551. function pushbutton4_Callback(hObject, eventdata, handles)
  552. % hObject handle to pushbutton4 (see GCBO)
  553. % eventdata reserved - to be defined in a future version of MATLAB
  554. % handles structure with handles and user data (see GUIDATA)
  555. global reason start goal
  556. global h_waitbar
  557. set(handles.edit57,'string',1);set(handles.edit58,'string',1);set(handles.edit59,'string',1);
  558. set(handles.edit60,'string',1);set(handles.edit61,'string',1);
  559. set(handles.edit2,'string',start);
  560. set(handles.edit3,'string',goal);
  561. set(handles.edit38,'string','正在运行');
  562. set(handles.text60,'visible','off')
  563. tic;
  564. h_waitbar = waitbar(0,'正在运行,请稍后...');
  565. if reason == 1 % 如果是第一个目的,即选择一种算法进行分析,则选择一种算法运行
  566. prime_only_one_algorithm(hObject, eventdata, handles)
  567. elseif reason==2 % 如果是第二个目的,即选择多种算法进行分析
  568. prime_multi_algorithm(hObject, eventdata, handles)
  569. end
  570. delete(h_waitbar);
  571. time_algorithm = round(toc);
  572. tip_time = ['运行结束,已运行',num2str(time_algorithm),'秒'];
  573. set(handles.edit38,'string',tip_time);
  574. function edit91_Callback(hObject, eventdata, handles)
  575. % hObject handle to edit91 (see GCBO)
  576. % eventdata reserved - to be defined in a future version of MATLAB
  577. % handles structure with handles and user data (see GUIDATA)
  578. % Hints: get(hObject,'String') returns contents of edit91 as text
  579. % str2double(get(hObject,'String')) returns contents of edit91 as a double
  580. % --- Executes during object creation, after setting all properties.
  581. function edit91_CreateFcn(hObject, eventdata, handles)
  582. % hObject handle to edit91 (see GCBO)
  583. % eventdata reserved - to be defined in a future version of MATLAB
  584. % handles empty - handles not created until after all CreateFcns called
  585. % Hint: edit controls usually have a white background on Windows.
  586. % See ISPC and COMPUTER.
  587. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  588. set(hObject,'BackgroundColor','white');
  589. end
  590. function edit12_Callback(hObject, eventdata, handles)
  591. % hObject handle to edit12 (see GCBO)
  592. % eventdata reserved - to be defined in a future version of MATLAB
  593. % handles structure with handles and user data (see GUIDATA)
  594. % Hints: get(hObject,'String') returns contents of edit12 as text
  595. % str2double(get(hObject,'String')) returns contents of edit12 as a double
  596. % --- Executes during object creation, after setting all properties.
  597. function edit12_CreateFcn(hObject, eventdata, handles)
  598. % hObject handle to edit12 (see GCBO)
  599. % eventdata reserved - to be defined in a future version of MATLAB
  600. % handles empty - handles not created until after all CreateFcns called
  601. % Hint: edit controls usually have a white background on Windows.
  602. % See ISPC and COMPUTER.
  603. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  604. set(hObject,'BackgroundColor','white');
  605. end
  606. function edit13_Callback(hObject, eventdata, handles)
  607. % hObject handle to edit13 (see GCBO)
  608. % eventdata reserved - to be defined in a future version of MATLAB
  609. % handles structure with handles and user data (see GUIDATA)
  610. % Hints: get(hObject,'String') returns contents of edit13 as text
  611. % str2double(get(hObject,'String')) returns contents of edit13 as a double
  612. % --- Executes during object creation, after setting all properties.
  613. function edit13_CreateFcn(hObject, eventdata, handles)
  614. % hObject handle to edit13 (see GCBO)
  615. % eventdata reserved - to be defined in a future version of MATLAB
  616. % handles empty - handles not created until after all CreateFcns called
  617. % Hint: edit controls usually have a white background on Windows.
  618. % See ISPC and COMPUTER.
  619. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  620. set(hObject,'BackgroundColor','white');
  621. end
  622. function edit14_Callback(hObject, eventdata, handles)
  623. % hObject handle to edit14 (see GCBO)
  624. % eventdata reserved - to be defined in a future version of MATLAB
  625. % handles structure with handles and user data (see GUIDATA)
  626. % Hints: get(hObject,'String') returns contents of edit14 as text
  627. % str2double(get(hObject,'String')) returns contents of edit14 as a double
  628. % --- Executes during object creation, after setting all properties.
  629. function edit14_CreateFcn(hObject, eventdata, handles)
  630. % hObject handle to edit14 (see GCBO)
  631. % eventdata reserved - to be defined in a future version of MATLAB
  632. % handles empty - handles not created until after all CreateFcns called
  633. % Hint: edit controls usually have a white background on Windows.
  634. % See ISPC and COMPUTER.
  635. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  636. set(hObject,'BackgroundColor','white');
  637. end
  638. function edit92_Callback(hObject, eventdata, handles)
  639. % hObject handle to edit92 (see GCBO)
  640. % eventdata reserved - to be defined in a future version of MATLAB
  641. % handles structure with handles and user data (see GUIDATA)
  642. % Hints: get(hObject,'String') returns contents of edit92 as text
  643. % str2double(get(hObject,'String')) returns contents of edit92 as a double
  644. % --- Executes during object creation, after setting all properties.
  645. function edit92_CreateFcn(hObject, eventdata, handles)
  646. % hObject handle to edit92 (see GCBO)
  647. % eventdata reserved - to be defined in a future version of MATLAB
  648. % handles empty - handles not created until after all CreateFcns called
  649. % Hint: edit controls usually have a white background on Windows.
  650. % See ISPC and COMPUTER.
  651. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  652. set(hObject,'BackgroundColor','white');
  653. end
  654. function edit16_Callback(hObject, eventdata, handles)
  655. % hObject handle to edit16 (see GCBO)
  656. % eventdata reserved - to be defined in a future version of MATLAB
  657. % handles structure with handles and user data (see GUIDATA)
  658. % Hints: get(hObject,'String') returns contents of edit16 as text
  659. % str2double(get(hObject,'String')) returns contents of edit16 as a double
  660. % --- Executes during object creation, after setting all properties.
  661. function edit16_CreateFcn(hObject, eventdata, handles)
  662. % hObject handle to edit16 (see GCBO)
  663. % eventdata reserved - to be defined in a future version of MATLAB
  664. % handles empty - handles not created until after all CreateFcns called
  665. % Hint: edit controls usually have a white background on Windows.
  666. % See ISPC and COMPUTER.
  667. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  668. set(hObject,'BackgroundColor','white');
  669. end
  670. function edit94_Callback(hObject, eventdata, handles)
  671. % hObject handle to edit94 (see GCBO)
  672. % eventdata reserved - to be defined in a future version of MATLAB
  673. % handles structure with handles and user data (see GUIDATA)
  674. % Hints: get(hObject,'String') returns contents of edit94 as text
  675. % str2double(get(hObject,'String')) returns contents of edit94 as a double
  676. % --- Executes during object creation, after setting all properties.
  677. function edit94_CreateFcn(hObject, eventdata, handles)
  678. % hObject handle to edit94 (see GCBO)
  679. % eventdata reserved - to be defined in a future version of MATLAB
  680. % handles empty - handles not created until after all CreateFcns called
  681. % Hint: edit controls usually have a white background on Windows.
  682. % See ISPC and COMPUTER.
  683. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  684. set(hObject,'BackgroundColor','white');
  685. end
  686. function edit18_Callback(hObject, eventdata, handles)
  687. % hObject handle to edit18 (see GCBO)
  688. % eventdata reserved - to be defined in a future version of MATLAB
  689. % handles structure with handles and user data (see GUIDATA)
  690. % Hints: get(hObject,'String') returns contents of edit18 as text
  691. % str2double(get(hObject,'String')) returns contents of edit18 as a double
  692. % --- Executes during object creation, after setting all properties.
  693. function edit18_CreateFcn(hObject, eventdata, handles)
  694. % hObject handle to edit18 (see GCBO)
  695. % eventdata reserved - to be defined in a future version of MATLAB
  696. % handles empty - handles not created until after all CreateFcns called
  697. % Hint: edit controls usually have a white background on Windows.
  698. % See ISPC and COMPUTER.
  699. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  700. set(hObject,'BackgroundColor','white');
  701. end
  702. % --- Executes on button press in radiobutton5.
  703. function radiobutton5_Callback(hObject, eventdata, handles)
  704. % hObject handle to radiobutton5 (see GCBO)
  705. % eventdata reserved - to be defined in a future version of MATLAB
  706. % handles structure with handles and user data (see GUIDATA)
  707. % Hint: get(hObject,'Value') returns toggle state of radiobutton5
  708. set(handles.uipanel200,'visible','on')
  709. set(handles.uipanel201,'visible','off')
  710. set(handles.uipanel202,'visible','off')
  711. set(handles.uipanel203,'visible','off')
  712. set(handles.uipanel204,'visible','off')
  713. % --- Executes on button press in radiobutton6.
  714. function radiobutton6_Callback(hObject, eventdata, handles)
  715. % hObject handle to radiobutton6 (see GCBO)
  716. % eventdata reserved - to be defined in a future version of MATLAB
  717. % handles structure with handles and user data (see GUIDATA)
  718. % Hint: get(hObject,'Value') returns toggle state of radiobutton6
  719. set(handles.uipanel200,'visible','off')
  720. set(handles.uipanel201,'visible','off')
  721. set(handles.uipanel202,'visible','off')
  722. set(handles.uipanel203,'visible','on')
  723. set(handles.uipanel204,'visible','off')
  724. % --- Executes on button press in radiobutton7.
  725. function radiobutton7_Callback(hObject, eventdata, handles)
  726. % hObject handle to radiobutton7 (see GCBO)
  727. % eventdata reserved - to be defined in a future version of MATLAB
  728. % handles structure with handles and user data (see GUIDATA)
  729. % Hint: get(hObject,'Value') returns toggle state of radiobutton7
  730. set(handles.uipanel200,'visible','off')
  731. set(handles.uipanel201,'visible','off')
  732. set(handles.uipanel202,'visible','off')
  733. set(handles.uipanel203,'visible','off')
  734. set(handles.uipanel204,'visible','on')
  735. % --- Executes when figure1 is resized.
  736. function figure1_ResizeFcn(hObject, eventdata, handles)
  737. % hObject handle to figure1 (see GCBO)
  738. % eventdata reserved - to be defined in a future version of MATLAB
  739. % handles structure with handles and user data (see GUIDATA)
  740. function edit93_Callback(hObject, eventdata, handles)
  741. % hObject handle to edit93 (see GCBO)
  742. % eventdata reserved - to be defined in a future version of MATLAB
  743. % handles structure with handles and user data (see GUIDATA)
  744. % Hints: get(hObject,'String') returns contents of edit93 as text
  745. % str2double(get(hObject,'String')) returns contents of edit93 as a double
  746. % --- Executes during object creation, after setting all properties.
  747. function edit93_CreateFcn(hObject, eventdata, handles)
  748. % hObject handle to edit93 (see GCBO)
  749. % eventdata reserved - to be defined in a future version of MATLAB
  750. % handles empty - handles not created until after all CreateFcns called
  751. % Hint: edit controls usually have a white background on Windows.
  752. % See ISPC and COMPUTER.
  753. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  754. set(hObject,'BackgroundColor','white');
  755. end
  756. function edit24_Callback(hObject, eventdata, handles)
  757. % hObject handle to edit24 (see GCBO)
  758. % eventdata reserved - to be defined in a future version of MATLAB
  759. % handles structure with handles and user data (see GUIDATA)
  760. % Hints: get(hObject,'String') returns contents of edit24 as text
  761. % str2double(get(hObject,'String')) returns contents of edit24 as a double
  762. % --- Executes during object creation, after setting all properties.
  763. function edit24_CreateFcn(hObject, eventdata, handles)
  764. % hObject handle to edit24 (see GCBO)
  765. % eventdata reserved - to be defined in a future version of MATLAB
  766. % handles empty - handles not created until after all CreateFcns called
  767. % Hint: edit controls usually have a white background on Windows.
  768. % See ISPC and COMPUTER.
  769. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  770. set(hObject,'BackgroundColor','white');
  771. end
  772. function edit25_Callback(hObject, eventdata, handles)
  773. % hObject handle to edit25 (see GCBO)
  774. % eventdata reserved - to be defined in a future version of MATLAB
  775. % handles structure with handles and user data (see GUIDATA)
  776. % Hints: get(hObject,'String') returns contents of edit25 as text
  777. % str2double(get(hObject,'String')) returns contents of edit25 as a double
  778. % --- Executes during object creation, after setting all properties.
  779. function edit25_CreateFcn(hObject, eventdata, handles)
  780. % hObject handle to edit25 (see GCBO)
  781. % eventdata reserved - to be defined in a future version of MATLAB
  782. % handles empty - handles not created until after all CreateFcns called
  783. % Hint: edit controls usually have a white background on Windows.
  784. % See ISPC and COMPUTER.
  785. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  786. set(hObject,'BackgroundColor','white');
  787. end
  788. function edit26_Callback(hObject, eventdata, handles)
  789. % hObject handle to edit26 (see GCBO)
  790. % eventdata reserved - to be defined in a future version of MATLAB
  791. % handles structure with handles and user data (see GUIDATA)
  792. % Hints: get(hObject,'String') returns contents of edit26 as text
  793. % str2double(get(hObject,'String')) returns contents of edit26 as a double
  794. % --- Executes during object creation, after setting all properties.
  795. function edit26_CreateFcn(hObject, eventdata, handles)
  796. % hObject handle to edit26 (see GCBO)
  797. % eventdata reserved - to be defined in a future version of MATLAB
  798. % handles empty - handles not created until after all CreateFcns called
  799. % Hint: edit controls usually have a white background on Windows.
  800. % See ISPC and COMPUTER.
  801. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  802. set(hObject,'BackgroundColor','white');
  803. end
  804. function edit27_Callback(hObject, eventdata, handles)
  805. % hObject handle to edit27 (see GCBO)
  806. % eventdata reserved - to be defined in a future version of MATLAB
  807. % handles structure with handles and user data (see GUIDATA)
  808. % Hints: get(hObject,'String') returns contents of edit27 as text
  809. % str2double(get(hObject,'String')) returns contents of edit27 as a double
  810. % --- Executes during object creation, after setting all properties.
  811. function edit27_CreateFcn(hObject, eventdata, handles)
  812. % hObject handle to edit27 (see GCBO)
  813. % eventdata reserved - to be defined in a future version of MATLAB
  814. % handles empty - handles not created until after all CreateFcns called
  815. % Hint: edit controls usually have a white background on Windows.
  816. % See ISPC and COMPUTER.
  817. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  818. set(hObject,'BackgroundColor','white');
  819. end
  820. function edit28_Callback(hObject, eventdata, handles)
  821. % hObject handle to edit28 (see GCBO)
  822. % eventdata reserved - to be defined in a future version of MATLAB
  823. % handles structure with handles and user data (see GUIDATA)
  824. % Hints: get(hObject,'String') returns contents of edit28 as text
  825. % str2double(get(hObject,'String')) returns contents of edit28 as a double
  826. % --- Executes during object creation, after setting all properties.
  827. function edit28_CreateFcn(hObject, eventdata, handles)
  828. % hObject handle to edit28 (see GCBO)
  829. % eventdata reserved - to be defined in a future version of MATLAB
  830. % handles empty - handles not created until after all CreateFcns called
  831. % Hint: edit controls usually have a white background on Windows.
  832. % See ISPC and COMPUTER.
  833. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  834. set(hObject,'BackgroundColor','white');
  835. end
  836. function edit101_Callback(hObject, eventdata, handles)
  837. % hObject handle to edit101 (see GCBO)
  838. % eventdata reserved - to be defined in a future version of MATLAB
  839. % handles structure with handles and user data (see GUIDATA)
  840. % Hints: get(hObject,'String') returns contents of edit101 as text
  841. % str2double(get(hObject,'String')) returns contents of edit101 as a double
  842. % --- Executes during object creation, after setting all properties.
  843. function edit101_CreateFcn(hObject, eventdata, handles)
  844. % hObject handle to edit101 (see GCBO)
  845. % eventdata reserved - to be defined in a future version of MATLAB
  846. % handles empty - handles not created until after all CreateFcns called
  847. % Hint: edit controls usually have a white background on Windows.
  848. % See ISPC and COMPUTER.
  849. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  850. set(hObject,'BackgroundColor','white');
  851. end
  852. function edit102_Callback(hObject, eventdata, handles)
  853. % hObject handle to edit102 (see GCBO)
  854. % eventdata reserved - to be defined in a future version of MATLAB
  855. % handles structure with handles and user data (see GUIDATA)
  856. % Hints: get(hObject,'String') returns contents of edit102 as text
  857. % str2double(get(hObject,'String')) returns contents of edit102 as a double
  858. % --- Executes during object creation, after setting all properties.
  859. function edit102_CreateFcn(hObject, eventdata, handles)
  860. % hObject handle to edit102 (see GCBO)
  861. % eventdata reserved - to be defined in a future version of MATLAB
  862. % handles empty - handles not created until after all CreateFcns called
  863. % Hint: edit controls usually have a white background on Windows.
  864. % See ISPC and COMPUTER.
  865. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  866. set(hObject,'BackgroundColor','white');
  867. end
  868. function edit104_Callback(hObject, eventdata, handles)
  869. % hObject handle to edit104 (see GCBO)
  870. % eventdata reserved - to be defined in a future version of MATLAB
  871. % handles structure with handles and user data (see GUIDATA)
  872. % Hints: get(hObject,'String') returns contents of edit104 as text
  873. % str2double(get(hObject,'String')) returns contents of edit104 as a double
  874. % --- Executes during object creation, after setting all properties.
  875. function edit104_CreateFcn(hObject, eventdata, handles)
  876. % hObject handle to edit104 (see GCBO)
  877. % eventdata reserved - to be defined in a future version of MATLAB
  878. % handles empty - handles not created until after all CreateFcns called
  879. % Hint: edit controls usually have a white background on Windows.
  880. % See ISPC and COMPUTER.
  881. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  882. set(hObject,'BackgroundColor','white');
  883. end
  884. function edit105_Callback(hObject, eventdata, handles)
  885. % hObject handle to edit105 (see GCBO)
  886. % eventdata reserved - to be defined in a future version of MATLAB
  887. % handles structure with handles and user data (see GUIDATA)
  888. % Hints: get(hObject,'String') returns contents of edit105 as text
  889. % str2double(get(hObject,'String')) returns contents of edit105 as a double
  890. % --- Executes during object creation, after setting all properties.
  891. function edit105_CreateFcn(hObject, eventdata, handles)
  892. % hObject handle to edit105 (see GCBO)
  893. % eventdata reserved - to be defined in a future version of MATLAB
  894. % handles empty - handles not created until after all CreateFcns called
  895. % Hint: edit controls usually have a white background on Windows.
  896. % See ISPC and COMPUTER.
  897. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  898. set(hObject,'BackgroundColor','white');
  899. end
  900. function edit106_Callback(hObject, eventdata, handles)
  901. % hObject handle to edit106 (see GCBO)
  902. % eventdata reserved - to be defined in a future version of MATLAB
  903. % handles structure with handles and user data (see GUIDATA)
  904. % Hints: get(hObject,'String') returns contents of edit106 as text
  905. % str2double(get(hObject,'String')) returns contents of edit106 as a double
  906. % --- Executes during object creation, after setting all properties.
  907. function edit106_CreateFcn(hObject, eventdata, handles)
  908. % hObject handle to edit106 (see GCBO)
  909. % eventdata reserved - to be defined in a future version of MATLAB
  910. % handles empty - handles not created until after all CreateFcns called
  911. % Hint: edit controls usually have a white background on Windows.
  912. % See ISPC and COMPUTER.
  913. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  914. set(hObject,'BackgroundColor','white');
  915. end
  916. % --- Executes on button press in pushbutton5.
  917. function pushbutton5_Callback(hObject, eventdata, handles)
  918. % hObject handle to pushbutton5 (see GCBO)
  919. % eventdata reserved - to be defined in a future version of MATLAB
  920. % handles structure with handles and user data (see GUIDATA)
  921. % --- Executes on button press in pushbutton6.
  922. function pushbutton6_Callback(hObject, eventdata, handles)
  923. % hObject handle to pushbutton6 (see GCBO)
  924. % eventdata reserved - to be defined in a future version of MATLAB
  925. % handles structure with handles and user data (see GUIDATA)
  926. % --- Executes on button press in pushbutton7.
  927. function pushbutton7_Callback(hObject, eventdata, handles)
  928. % hObject handle to pushbutton7 (see GCBO)
  929. % eventdata reserved - to be defined in a future version of MATLAB
  930. % handles structure with handles and user data (see GUIDATA)
  931. % --- Executes on button press in pushbutton8.
  932. function pushbutton8_Callback(hObject, eventdata, handles)
  933. % hObject handle to pushbutton8 (see GCBO)
  934. % eventdata reserved - to be defined in a future version of MATLAB
  935. % handles structure with handles and user data (see GUIDATA)
  936. % --- Executes on button press in radiobutton9.
  937. function radiobutton9_Callback(hObject, eventdata, handles)
  938. % hObject handle to radiobutton9 (see GCBO)
  939. % eventdata reserved - to be defined in a future version of MATLAB
  940. % handles structure with handles and user data (see GUIDATA)
  941. % Hint: get(hObject,'Value') returns toggle state of radiobutton9
  942. % --- Executes on button press in radiobutton10.
  943. function radiobutton10_Callback(hObject, eventdata, handles)
  944. % hObject handle to radiobutton10 (see GCBO)
  945. % eventdata reserved - to be defined in a future version of MATLAB
  946. % handles structure with handles and user data (see GUIDATA)
  947. % Hint: get(hObject,'Value') returns toggle state of radiobutton10
  948. % --- Executes on button press in pushbutton9.
  949. function pushbutton9_Callback(hObject, eventdata, handles)
  950. % hObject handle to pushbutton9 (see GCBO)
  951. % eventdata reserved - to be defined in a future version of MATLAB
  952. % handles structure with handles and user data (see GUIDATA)
  953. % --- Executes on button press in pushbutton10.
  954. function pushbutton10_Callback(hObject, eventdata, handles)
  955. % hObject handle to pushbutton10 (see GCBO)
  956. % eventdata reserved - to be defined in a future version of MATLAB
  957. % handles structure with handles and user data (see GUIDATA)
  958. % --- Executes on button press in pushbutton11.
  959. function pushbutton11_Callback(hObject, eventdata, handles)
  960. % hObject handle to pushbutton11 (see GCBO)
  961. % eventdata reserved - to be defined in a future version of MATLAB
  962. % handles structure with handles and user data (see GUIDATA)
  963. function edit34_Callback(hObject, eventdata, handles)
  964. % hObject handle to edit34 (see GCBO)
  965. % eventdata reserved - to be defined in a future version of MATLAB
  966. % handles structure with handles and user data (see GUIDATA)
  967. % Hints: get(hObject,'String') returns contents of edit34 as text
  968. % str2double(get(hObject,'String')) returns contents of edit34 as a double
  969. % --- Executes during object creation, after setting all properties.
  970. function edit34_CreateFcn(hObject, eventdata, handles)
  971. % hObject handle to edit34 (see GCBO)
  972. % eventdata reserved - to be defined in a future version of MATLAB
  973. % handles empty - handles not created until after all CreateFcns called
  974. % Hint: edit controls usually have a white background on Windows.
  975. % See ISPC and COMPUTER.
  976. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  977. set(hObject,'BackgroundColor','white');
  978. end
  979. function edit35_Callback(hObject, eventdata, handles)
  980. % hObject handle to edit35 (see GCBO)
  981. % eventdata reserved - to be defined in a future version of MATLAB
  982. % handles structure with handles and user data (see GUIDATA)
  983. % Hints: get(hObject,'String') returns contents of edit35 as text
  984. % str2double(get(hObject,'String')) returns contents of edit35 as a double
  985. % --- Executes during object creation, after setting all properties.
  986. function edit35_CreateFcn(hObject, eventdata, handles)
  987. % hObject handle to edit35 (see GCBO)
  988. % eventdata reserved - to be defined in a future version of MATLAB
  989. % handles empty - handles not created until after all CreateFcns called
  990. % Hint: edit controls usually have a white background on Windows.
  991. % See ISPC and COMPUTER.
  992. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  993. set(hObject,'BackgroundColor','white');
  994. end
  995. % --- Executes on button press in radiobutton11.
  996. function radiobutton11_Callback(hObject, eventdata, handles)
  997. % hObject handle to radiobutton11 (see GCBO)
  998. % eventdata reserved - to be defined in a future version of MATLAB
  999. % handles structure with handles and user data (see GUIDATA)
  1000. % Hint: get(hObject,'Value') returns toggle state of radiobutton11
  1001. % --- Executes on button press in radiobutton12.
  1002. function radiobutton12_Callback(hObject, eventdata, handles)
  1003. % hObject handle to radiobutton12 (see GCBO)
  1004. % eventdata reserved - to be defined in a future version of MATLAB
  1005. % handles structure with handles and user data (see GUIDATA)
  1006. % Hint: get(hObject,'Value') returns toggle state of radiobutton12
  1007. % --- Executes on button press in pushbutton12.
  1008. function pushbutton12_Callback(hObject, eventdata, handles)
  1009. % hObject handle to pushbutton12 (see GCBO)
  1010. % eventdata reserved - to be defined in a future version of MATLAB
  1011. % handles structure with handles and user data (see GUIDATA)
  1012. % --------------------------------------------------------------------
  1013. function Untitled_1_Callback(hObject, eventdata, handles)
  1014. % hObject handle to Untitled_1 (see GCBO)
  1015. % eventdata reserved - to be defined in a future version of MATLAB
  1016. % handles structure with handles and user data (see GUIDATA)
  1017. function figure1_windowbuttondownfcn(hobj,event)
  1018. % point_data 输出,输出当前的一个点
  1019. % 定义figure的回调函数
  1020. global draw_enable x y data barrier pushbutton1_userdata
  1021. % if pushbutton1_userdata == 0
  1022. % set(handles.edit38,'string','如果需要设计障碍物图形,请先点击设计障碍物按钮');
  1023. % disp('如果需要设计障碍物图形,请先点击设计障碍物按钮')
  1024. if pushbutton1_userdata ==1
  1025. n_barrier = size(barrier,1);
  1026. % 若figure的selectiontype属性值为normal,则表示单击鼠标左键
  1027. if strcmp(get(hobj,'SelectionType'),'normal')
  1028. draw_enable = 1;
  1029. p = get(gca,'currentpoint'); % 取鼠标当前所在点的坐标
  1030. x(1) = p(1);% 当前点的横坐标
  1031. x1_floor = floor(x(1));
  1032. x1_ceil = ceil(x(1));
  1033. y(1) = p(3);% 当前点的纵坐标
  1034. y1_floor = floor(y(1));
  1035. y1_ceil = ceil(y(1));
  1036. data = [x1_floor,y1_floor;...
  1037. x1_ceil,y1_floor;...
  1038. x1_ceil,y1_ceil;...
  1039. x1_floor,y1_ceil]; % 依次取该点的周围四个顶点
  1040. x_data = [x1_floor,x1_ceil,x1_ceil,x1_floor];
  1041. y_data = [y1_floor,y1_floor,y1_ceil,y1_ceil];
  1042. fill(x_data,y_data,[0,0,0]); % 填充这个方格为黑色
  1043. % 设置这个方格不可用,即设置barrier中对应方格为1(表示该方格是障碍)
  1044. y1_ceil_temp = n_barrier - y1_ceil + 1;
  1045. barrier(y1_ceil_temp,x1_ceil) = 1;
  1046. end
  1047. % 如果figure的selectiontype属性值为alt,则表示双击鼠标,使方格为白色,可以安全行走
  1048. if strcmp(get(hobj,'selectiontype'),'open')
  1049. draw_enable = 0;
  1050. p = get(gca,'currentpoint'); % 取鼠标当前所在点的坐标
  1051. x(1) = p(1);% 当前点的横坐标
  1052. x1_floor = floor(x(1));
  1053. x1_ceil = ceil(x(1));
  1054. y(1) = p(3);% 当前点的纵坐标
  1055. y1_floor = floor(y(1));
  1056. y1_ceil = ceil(y(1));
  1057. data = [x1_floor,y1_floor;...
  1058. x1_ceil,y1_floor;...
  1059. x1_ceil,y1_ceil;...
  1060. x1_floor,y1_ceil]; % 依次取该点的周围四个顶点
  1061. x_data = [x1_floor,x1_ceil,x1_ceil,x1_floor];
  1062. y_data = [y1_floor,y1_floor,y1_ceil,y1_ceil];
  1063. fill(x_data,y_data,[1,1,1]); % 填充这个方格为白色
  1064. % 设置这个方格可用,即设置barrier中对应方格为0(表示该方格是障碍)
  1065. y1_ceil_temp = n_barrier - y1_ceil + 1;
  1066. barrier(y1_ceil_temp,x1_ceil) = 0;
  1067. end
  1068. % % 如果是鼠标右键,则输出并保存当前设置的障碍物信息
  1069. % if strcmp(get(hobj,'selectiontype'),'alt')
  1070. % disp(barrier)
  1071. % end
  1072. end
  1073. % --- Executes on button press in pushbutton13.
  1074. function pushbutton13_Callback(hObject, eventdata, handles)
  1075. % hObject handle to pushbutton13 (see GCBO)
  1076. % eventdata reserved - to be defined in a future version of MATLAB
  1077. % handles structure with handles and user data (see GUIDATA)
  1078. global barrier pushbutton1_userdata
  1079. % disp(barrier);
  1080. cd('barrier')
  1081. delete barrier_tmp.xls
  1082. xlswrite('barrier_tmp.xls',barrier)
  1083. pushbutton1_userdata = 0;
  1084. cd ..
  1085. % --- Executes on button press in pushbutton14.
  1086. function pushbutton14_Callback(hObject, eventdata, handles)
  1087. % hObject handle to pushbutton14 (see GCBO)
  1088. % eventdata reserved - to be defined in a future version of MATLAB
  1089. % handles structure with handles and user data (see GUIDATA)
  1090. global reason
  1091. set(handles.edit38,'string','请选择一种算法分析,默认选择ACO,并请继续实验设置');
  1092. init_reason1(handles);
  1093. reason = 1;% 实验目标模式,用在后面判断表格和图形的设计,以及采用何种算法设置框
  1094. function edit36_Callback(hObject, eventdata, handles)
  1095. % hObject handle to edit36 (see GCBO)
  1096. % eventdata reserved - to be defined in a future version of MATLAB
  1097. % handles structure with handles and user data (see GUIDATA)
  1098. % Hints: get(hObject,'String') returns contents of edit36 as text
  1099. % str2double(get(hObject,'String')) returns contents of edit36 as a double
  1100. % --- Executes during object creation, after setting all properties.
  1101. function edit36_CreateFcn(hObject, eventdata, handles)
  1102. % hObject handle to edit36 (see GCBO)
  1103. % eventdata reserved - to be defined in a future version of MATLAB
  1104. % handles empty - handles not created until after all CreateFcns called
  1105. % Hint: edit controls usually have a white background on Windows.
  1106. % See ISPC and COMPUTER.
  1107. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1108. set(hObject,'BackgroundColor','white');
  1109. end
  1110. % --- Executes on button press in pushbutton15.
  1111. function pushbutton15_Callback(hObject, eventdata, handles)
  1112. % hObject handle to pushbutton15 (see GCBO)
  1113. % eventdata reserved - to be defined in a future version of MATLAB
  1114. % handles structure with handles and user data (see GUIDATA)
  1115. global reason
  1116. set(handles.edit38,'string','请选择几类算法分析,默认选择全部算法进行比较');
  1117. init_reason2(handles);
  1118. reason = 2; % 实验目标模式,用在后面判断画图
  1119. function edit37_Callback(hObject, eventdata, handles)
  1120. % hObject handle to edit37 (see GCBO)
  1121. % eventdata reserved - to be defined in a future version of MATLAB
  1122. % handles structure with handles and user data (see GUIDATA)
  1123. % Hints: get(hObject,'String') returns contents of edit37 as text
  1124. % str2double(get(hObject,'String')) returns contents of edit37 as a double
  1125. % --- Executes during object creation, after setting all properties.
  1126. function edit37_CreateFcn(hObject, eventdata, handles)
  1127. % hObject handle to edit37 (see GCBO)
  1128. % eventdata reserved - to be defined in a future version of MATLAB
  1129. % handles empty - handles not created until after all CreateFcns called
  1130. % Hint: edit controls usually have a white background on Windows.
  1131. % See ISPC and COMPUTER.
  1132. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1133. set(hObject,'BackgroundColor','white');
  1134. end
  1135. % --- Executes on button press in pushbutton16.
  1136. function pushbutton16_Callback(hObject, eventdata, handles)
  1137. % hObject handle to pushbutton16 (see GCBO)
  1138. % eventdata reserved - to be defined in a future version of MATLAB
  1139. % handles structure with handles and user data (see GUIDATA)
  1140. set(handles.uipanel1,'visible','on')
  1141. set(handles.uipanel6,'visible','off')
  1142. set(handles.uipanel7,'visible','off')
  1143. set(handles.uipanel5,'visible','off')
  1144. set(handles.uipanel15,'visible','off')
  1145. % --- Executes on button press in pushbutton17.
  1146. function pushbutton17_Callback(hObject, eventdata, handles)
  1147. % hObject handle to pushbutton17 (see GCBO)
  1148. % eventdata reserved - to be defined in a future version of MATLAB
  1149. % handles structure with handles and user data (see GUIDATA)
  1150. set(handles.uipanel1,'visible','off')
  1151. set(handles.uipanel6,'visible','on')
  1152. set(handles.uipanel7,'visible','off')
  1153. set(handles.uipanel5,'visible','off')
  1154. set(handles.uipanel15,'visible','off')
  1155. % --- Executes on button press in pushbutton18.
  1156. function pushbutton18_Callback(hObject, eventdata, handles)
  1157. % hObject handle to pushbutton18 (see GCBO)
  1158. % eventdata reserved - to be defined in a future version of MATLAB
  1159. % handles structure with handles and user data (see GUIDATA)
  1160. global reason
  1161. set(handles.uipanel1,'visible','off')
  1162. set(handles.uipanel6,'visible','off')
  1163. set(handles.uipanel7,'visible','off')
  1164. if reason == 1
  1165. set(handles.uipanel5,'visible','off')
  1166. set(handles.uipanel15,'visible','on')
  1167. end
  1168. if reason == 2
  1169. set(handles.uipanel5,'visible','on')
  1170. set(handles.uipanel15,'visible','off')
  1171. end
  1172. % --- Executes on button press in pushbutton19.
  1173. function pushbutton19_Callback(hObject, eventdata, handles)
  1174. % hObject handle to pushbutton19 (see GCBO)
  1175. % eventdata reserved - to be defined in a future version of MATLAB
  1176. % handles structure with handles and user data (see GUIDATA)
  1177. set(handles.uipanel1,'visible','off')
  1178. set(handles.uipanel6,'visible','off')
  1179. set(handles.uipanel7,'visible','on')
  1180. set(handles.uipanel5,'visible','off')
  1181. set(handles.uipanel15,'visible','off')
  1182. % --- Executes during object creation, after setting all properties.
  1183. function uipanel5_CreateFcn(hObject, eventdata, handles)
  1184. % hObject handle to uipanel5 (see GCBO)
  1185. % eventdata reserved - to be defined in a future version of MATLAB
  1186. % handles empty - handles not created until after all CreateFcns called
  1187. % --- Executes during object deletion, before destroying properties.
  1188. function text25_DeleteFcn(hObject, eventdata, handles)
  1189. % hObject handle to text25 (see GCBO)
  1190. % eventdata reserved - to be defined in a future version of MATLAB
  1191. % handles structure with handles and user data (see GUIDATA)
  1192. % --- Executes during object creation, after setting all properties.
  1193. function text25_CreateFcn(hObject, eventdata, handles)
  1194. % hObject handle to text25 (see GCBO)
  1195. % eventdata reserved - to be defined in a future version of MATLAB
  1196. % handles empty - handles not created until after all CreateFcns called
  1197. % --- Executes during object creation, after setting all properties.
  1198. function pushbutton14_CreateFcn(hObject, eventdata, handles)
  1199. % hObject handle to pushbutton14 (see GCBO)
  1200. % eventdata reserved - to be defined in a future version of MATLAB
  1201. % handles empty - handles not created until after all CreateFcns called
  1202. function edit38_Callback(hObject, eventdata, handles)
  1203. % hObject handle to edit38 (see GCBO)
  1204. % eventdata reserved - to be defined in a future version of MATLAB
  1205. % handles structure with handles and user data (see GUIDATA)
  1206. % Hints: get(hObject,'String') returns contents of edit38 as text
  1207. % str2double(get(hObject,'String')) returns contents of edit38 as a double
  1208. % --- Executes during object creation, after setting all properties.
  1209. function edit38_CreateFcn(hObject, eventdata, handles)
  1210. % hObject handle to edit38 (see GCBO)
  1211. % eventdata reserved - to be defined in a future version of MATLAB
  1212. % handles empty - handles not created until after all CreateFcns called
  1213. % Hint: edit controls usually have a white background on Windows.
  1214. % See ISPC and COMPUTER.
  1215. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1216. set(hObject,'BackgroundColor','white');
  1217. end
  1218. % --- Executes during object creation, after setting all properties.
  1219. function slider1_CreateFcn(hObject, eventdata, handles)
  1220. % hObject handle to slider1 (see GCBO)
  1221. % eventdata reserved - to be defined in a future version of MATLAB
  1222. % handles empty - handles not created until after all CreateFcns called
  1223. % Hint: slider controls usually have a light gray background.
  1224. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1225. set(hObject,'BackgroundColor',[.9 .9 .9]);
  1226. end
  1227. function edit39_Callback(hObject, eventdata, handles)
  1228. % hObject handle to edit39 (see GCBO)
  1229. % eventdata reserved - to be defined in a future version of MATLAB
  1230. % handles structure with handles and user data (see GUIDATA)
  1231. % Hints: get(hObject,'String') returns contents of edit39 as text
  1232. % str2double(get(hObject,'String')) returns contents of edit39 as a double
  1233. % --- Executes during object creation, after setting all properties.
  1234. function edit39_CreateFcn(hObject, eventdata, handles)
  1235. % hObject handle to edit39 (see GCBO)
  1236. % eventdata reserved - to be defined in a future version of MATLAB
  1237. % handles empty - handles not created until after all CreateFcns called
  1238. % Hint: edit controls usually have a white background on Windows.
  1239. % See ISPC and COMPUTER.
  1240. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1241. set(hObject,'BackgroundColor','white');
  1242. end
  1243. function edit201_Callback(hObject, eventdata, handles)
  1244. % hObject handle to edit201 (see GCBO)
  1245. % eventdata reserved - to be defined in a future version of MATLAB
  1246. % handles structure with handles and user data (see GUIDATA)
  1247. % Hints: get(hObject,'String') returns contents of edit201 as text
  1248. % str2double(get(hObject,'String')) returns contents of edit201 as a double
  1249. % --- Executes during object creation, after setting all properties.
  1250. function edit201_CreateFcn(hObject, eventdata, handles)
  1251. % hObject handle to edit201 (see GCBO)
  1252. % eventdata reserved - to be defined in a future version of MATLAB
  1253. % handles empty - handles not created until after all CreateFcns called
  1254. % Hint: edit controls usually have a white background on Windows.
  1255. % See ISPC and COMPUTER.
  1256. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1257. set(hObject,'BackgroundColor','white');
  1258. end
  1259. function edit202_Callback(hObject, eventdata, handles)
  1260. % hObject handle to edit202 (see GCBO)
  1261. % eventdata reserved - to be defined in a future version of MATLAB
  1262. % handles structure with handles and user data (see GUIDATA)
  1263. % Hints: get(hObject,'String') returns contents of edit202 as text
  1264. % str2double(get(hObject,'String')) returns contents of edit202 as a double
  1265. % --- Executes during object creation, after setting all properties.
  1266. function edit202_CreateFcn(hObject, eventdata, handles)
  1267. % hObject handle to edit202 (see GCBO)
  1268. % eventdata reserved - to be defined in a future version of MATLAB
  1269. % handles empty - handles not created until after all CreateFcns called
  1270. % Hint: edit controls usually have a white background on Windows.
  1271. % See ISPC and COMPUTER.
  1272. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1273. set(hObject,'BackgroundColor','white');
  1274. end
  1275. function edit84_Callback(hObject, eventdata, handles)
  1276. % hObject handle to edit84 (see GCBO)
  1277. % eventdata reserved - to be defined in a future version of MATLAB
  1278. % handles structure with handles and user data (see GUIDATA)
  1279. % Hints: get(hObject,'String') returns contents of edit84 as text
  1280. % str2double(get(hObject,'String')) returns contents of edit84 as a double
  1281. % --- Executes during object creation, after setting all properties.
  1282. function edit84_CreateFcn(hObject, eventdata, handles)
  1283. % hObject handle to edit84 (see GCBO)
  1284. % eventdata reserved - to be defined in a future version of MATLAB
  1285. % handles empty - handles not created until after all CreateFcns called
  1286. % Hint: edit controls usually have a white background on Windows.
  1287. % See ISPC and COMPUTER.
  1288. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1289. set(hObject,'BackgroundColor','white');
  1290. end
  1291. function edit203_Callback(hObject, eventdata, handles)
  1292. % hObject handle to edit203 (see GCBO)
  1293. % eventdata reserved - to be defined in a future version of MATLAB
  1294. % handles structure with handles and user data (see GUIDATA)
  1295. % Hints: get(hObject,'String') returns contents of edit203 as text
  1296. % str2double(get(hObject,'String')) returns contents of edit203 as a double
  1297. % --- Executes during object creation, after setting all properties.
  1298. function edit203_CreateFcn(hObject, eventdata, handles)
  1299. % hObject handle to edit203 (see GCBO)
  1300. % eventdata reserved - to be defined in a future version of MATLAB
  1301. % handles empty - handles not created until after all CreateFcns called
  1302. % Hint: edit controls usually have a white background on Windows.
  1303. % See ISPC and COMPUTER.
  1304. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1305. set(hObject,'BackgroundColor','white');
  1306. end
  1307. function edit111_Callback(hObject, eventdata, handles)
  1308. % hObject handle to edit111 (see GCBO)
  1309. % eventdata reserved - to be defined in a future version of MATLAB
  1310. % handles structure with handles and user data (see GUIDATA)
  1311. % Hints: get(hObject,'String') returns contents of edit111 as text
  1312. % str2double(get(hObject,'String')) returns contents of edit111 as a double
  1313. % --- Executes during object creation, after setting all properties.
  1314. function edit111_CreateFcn(hObject, eventdata, handles)
  1315. % hObject handle to edit111 (see GCBO)
  1316. % eventdata reserved - to be defined in a future version of MATLAB
  1317. % handles empty - handles not created until after all CreateFcns called
  1318. % Hint: edit controls usually have a white background on Windows.
  1319. % See ISPC and COMPUTER.
  1320. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1321. set(hObject,'BackgroundColor','white');
  1322. end
  1323. function edit112_Callback(hObject, eventdata, handles)
  1324. % hObject handle to edit112 (see GCBO)
  1325. % eventdata reserved - to be defined in a future version of MATLAB
  1326. % handles structure with handles and user data (see GUIDATA)
  1327. % Hints: get(hObject,'String') returns contents of edit112 as text
  1328. % str2double(get(hObject,'String')) returns contents of edit112 as a double
  1329. % --- Executes during object creation, after setting all properties.
  1330. function edit112_CreateFcn(hObject, eventdata, handles)
  1331. % hObject handle to edit112 (see GCBO)
  1332. % eventdata reserved - to be defined in a future version of MATLAB
  1333. % handles empty - handles not created until after all CreateFcns called
  1334. % Hint: edit controls usually have a white background on Windows.
  1335. % See ISPC and COMPUTER.
  1336. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1337. set(hObject,'BackgroundColor','white');
  1338. end
  1339. function edit114_Callback(hObject, eventdata, handles)
  1340. % hObject handle to edit114 (see GCBO)
  1341. % eventdata reserved - to be defined in a future version of MATLAB
  1342. % handles structure with handles and user data (see GUIDATA)
  1343. % Hints: get(hObject,'String') returns contents of edit114 as text
  1344. % str2double(get(hObject,'String')) returns contents of edit114 as a double
  1345. % --- Executes during object creation, after setting all properties.
  1346. function edit114_CreateFcn(hObject, eventdata, handles)
  1347. % hObject handle to edit114 (see GCBO)
  1348. % eventdata reserved - to be defined in a future version of MATLAB
  1349. % handles empty - handles not created until after all CreateFcns called
  1350. % Hint: edit controls usually have a white background on Windows.
  1351. % See ISPC and COMPUTER.
  1352. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1353. set(hObject,'BackgroundColor','white');
  1354. end
  1355. function edit113_Callback(hObject, eventdata, handles)
  1356. % hObject handle to edit113 (see GCBO)
  1357. % eventdata reserved - to be defined in a future version of MATLAB
  1358. % handles structure with handles and user data (see GUIDATA)
  1359. % Hints: get(hObject,'String') returns contents of edit113 as text
  1360. % str2double(get(hObject,'String')) returns contents of edit113 as a double
  1361. % --- Executes during object creation, after setting all properties.
  1362. function edit113_CreateFcn(hObject, eventdata, handles)
  1363. % hObject handle to edit113 (see GCBO)
  1364. % eventdata reserved - to be defined in a future version of MATLAB
  1365. % handles empty - handles not created until after all CreateFcns called
  1366. % Hint: edit controls usually have a white background on Windows.
  1367. % See ISPC and COMPUTER.
  1368. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1369. set(hObject,'BackgroundColor','white');
  1370. end
  1371. function edit115_Callback(hObject, eventdata, handles)
  1372. % hObject handle to edit115 (see GCBO)
  1373. % eventdata reserved - to be defined in a future version of MATLAB
  1374. % handles structure with handles and user data (see GUIDATA)
  1375. % Hints: get(hObject,'String') returns contents of edit115 as text
  1376. % str2double(get(hObject,'String')) returns contents of edit115 as a double
  1377. % --- Executes during object creation, after setting all properties.
  1378. function edit115_CreateFcn(hObject, eventdata, handles)
  1379. % hObject handle to edit115 (see GCBO)
  1380. % eventdata reserved - to be defined in a future version of MATLAB
  1381. % handles empty - handles not created until after all CreateFcns called
  1382. % Hint: edit controls usually have a white background on Windows.
  1383. % See ISPC and COMPUTER.
  1384. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1385. set(hObject,'BackgroundColor','white');
  1386. end
  1387. function edit204_Callback(hObject, eventdata, handles)
  1388. % hObject handle to edit204 (see GCBO)
  1389. % eventdata reserved - to be defined in a future version of MATLAB
  1390. % handles structure with handles and user data (see GUIDATA)
  1391. % Hints: get(hObject,'String') returns contents of edit204 as text
  1392. % str2double(get(hObject,'String')) returns contents of edit204 as a double
  1393. % --- Executes during object creation, after setting all properties.
  1394. function edit204_CreateFcn(hObject, eventdata, handles)
  1395. % hObject handle to edit204 (see GCBO)
  1396. % eventdata reserved - to be defined in a future version of MATLAB
  1397. % handles empty - handles not created until after all CreateFcns called
  1398. % Hint: edit controls usually have a white background on Windows.
  1399. % See ISPC and COMPUTER.
  1400. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1401. set(hObject,'BackgroundColor','white');
  1402. end
  1403. function edit103_Callback(hObject, eventdata, handles)
  1404. % hObject handle to edit103 (see GCBO)
  1405. % eventdata reserved - to be defined in a future version of MATLAB
  1406. % handles structure with handles and user data (see GUIDATA)
  1407. % Hints: get(hObject,'String') returns contents of edit103 as text
  1408. % str2double(get(hObject,'String')) returns contents of edit103 as a double
  1409. % --- Executes during object creation, after setting all properties.
  1410. function edit103_CreateFcn(hObject, eventdata, handles)
  1411. % hObject handle to edit103 (see GCBO)
  1412. % eventdata reserved - to be defined in a future version of MATLAB
  1413. % handles empty - handles not created until after all CreateFcns called
  1414. % Hint: edit controls usually have a white background on Windows.
  1415. % See ISPC and COMPUTER.
  1416. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1417. set(hObject,'BackgroundColor','white');
  1418. end
  1419. % --- Executes on button press in radiobutton16.
  1420. function radiobutton16_Callback(hObject, eventdata, handles)
  1421. % hObject handle to radiobutton16 (see GCBO)
  1422. % eventdata reserved - to be defined in a future version of MATLAB
  1423. % handles structure with handles and user data (see GUIDATA)
  1424. % Hint: get(hObject,'Value') returns toggle state of radiobutton16
  1425. set(handles.uipanel200,'visible','on')
  1426. set(handles.uipanel201,'visible','off')
  1427. set(handles.uipanel202,'visible','off')
  1428. set(handles.uipanel203,'visible','off')
  1429. set(handles.uipanel204,'visible','off')
  1430. % --- Executes on button press in radiobutton15.
  1431. function radiobutton15_Callback(hObject, eventdata, handles)
  1432. % hObject handle to radiobutton15 (see GCBO)
  1433. % eventdata reserved - to be defined in a future version of MATLAB
  1434. % handles structure with handles and user data (see GUIDATA)
  1435. % Hint: get(hObject,'Value') returns toggle state of radiobutton15
  1436. set(handles.uipanel200,'visible','off')
  1437. set(handles.uipanel201,'visible','on')
  1438. set(handles.uipanel202,'visible','off')
  1439. set(handles.uipanel203,'visible','off')
  1440. set(handles.uipanel204,'visible','off')
  1441. % --- Executes on button press in radiobutton14.
  1442. function radiobutton14_Callback(hObject, eventdata, handles)
  1443. % hObject handle to radiobutton14 (see GCBO)
  1444. % eventdata reserved - to be defined in a future version of MATLAB
  1445. % handles structure with handles and user data (see GUIDATA)
  1446. % Hint: get(hObject,'Value') returns toggle state of radiobutton14
  1447. set(handles.uipanel200,'visible','off')
  1448. set(handles.uipanel201,'visible','off')
  1449. set(handles.uipanel202,'visible','on')
  1450. set(handles.uipanel203,'visible','off')
  1451. set(handles.uipanel204,'visible','off')
  1452. % --- Executes on button press in radiobutton17.
  1453. function radiobutton17_Callback(hObject, eventdata, handles)
  1454. % hObject handle to radiobutton17 (see GCBO)
  1455. % eventdata reserved - to be defined in a future version of MATLAB
  1456. % handles structure with handles and user data (see GUIDATA)
  1457. % Hint: get(hObject,'Value') returns toggle state of radiobutton17
  1458. set(handles.uipanel200,'visible','off')
  1459. set(handles.uipanel201,'visible','off')
  1460. set(handles.uipanel202,'visible','off')
  1461. set(handles.uipanel203,'visible','on')
  1462. set(handles.uipanel204,'visible','off')
  1463. % --- Executes on button press in radiobutton18.
  1464. function radiobutton18_Callback(hObject, eventdata, handles)
  1465. % hObject handle to radiobutton18 (see GCBO)
  1466. % eventdata reserved - to be defined in a future version of MATLAB
  1467. % handles structure with handles and user data (see GUIDATA)
  1468. % Hint: get(hObject,'Value') returns toggle state of radiobutton18
  1469. set(handles.uipanel200,'visible','off')
  1470. set(handles.uipanel201,'visible','off')
  1471. set(handles.uipanel202,'visible','off')
  1472. set(handles.uipanel203,'visible','off')
  1473. set(handles.uipanel204,'visible','on')
  1474. function edit51_Callback(hObject, eventdata, handles)
  1475. % hObject handle to edit51 (see GCBO)
  1476. % eventdata reserved - to be defined in a future version of MATLAB
  1477. % handles structure with handles and user data (see GUIDATA)
  1478. % Hints: get(hObject,'String') returns contents of edit51 as text
  1479. % str2double(get(hObject,'String')) returns contents of edit51 as a double
  1480. % --- Executes during object creation, after setting all properties.
  1481. function edit51_CreateFcn(hObject, eventdata, handles)
  1482. % hObject handle to edit51 (see GCBO)
  1483. % eventdata reserved - to be defined in a future version of MATLAB
  1484. % handles empty - handles not created until after all CreateFcns called
  1485. % Hint: edit controls usually have a white background on Windows.
  1486. % See ISPC and COMPUTER.
  1487. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1488. set(hObject,'BackgroundColor','white');
  1489. end
  1490. % --- Executes during object creation, after setting all properties.
  1491. function edit85_CreateFcn(hObject, eventdata, handles)
  1492. % hObject handle to edit85 (see GCBO)
  1493. % eventdata reserved - to be defined in a future version of MATLAB
  1494. % handles empty - handles not created until after all CreateFcns called
  1495. % Hint: edit controls usually have a white background on Windows.
  1496. % See ISPC and COMPUTER.
  1497. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1498. set(hObject,'BackgroundColor','white');
  1499. end
  1500. % --- Executes during object creation, after setting all properties.
  1501. function edit83_CreateFcn(hObject, eventdata, handles)
  1502. % hObject handle to edit83 (see GCBO)
  1503. % eventdata reserved - to be defined in a future version of MATLAB
  1504. % handles empty - handles not created until after all CreateFcns called
  1505. % Hint: edit controls usually have a white background on Windows.
  1506. % See ISPC and COMPUTER.
  1507. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1508. set(hObject,'BackgroundColor','white');
  1509. end
  1510. % --- Executes during object creation, after setting all properties.
  1511. function edit82_CreateFcn(hObject, eventdata, handles)
  1512. % hObject handle to edit82 (see GCBO)
  1513. % eventdata reserved - to be defined in a future version of MATLAB
  1514. % handles empty - handles not created until after all CreateFcns called
  1515. % Hint: edit controls usually have a white background on Windows.
  1516. % See ISPC and COMPUTER.
  1517. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1518. set(hObject,'BackgroundColor','white');
  1519. end
  1520. % --- Executes during object creation, after setting all properties.
  1521. function edit81_CreateFcn(hObject, eventdata, handles)
  1522. % hObject handle to edit81 (see GCBO)
  1523. % eventdata reserved - to be defined in a future version of MATLAB
  1524. % handles empty - handles not created until after all CreateFcns called
  1525. % Hint: edit controls usually have a white background on Windows.
  1526. % See ISPC and COMPUTER.
  1527. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1528. set(hObject,'BackgroundColor','white');
  1529. end
  1530. % --- Executes on button press in pushbutton20.
  1531. function pushbutton20_Callback(hObject, eventdata, handles)
  1532. % hObject handle to pushbutton20 (see GCBO)
  1533. % eventdata reserved - to be defined in a future version of MATLAB
  1534. % handles structure with handles and user data (see GUIDATA)
  1535. global path_node diversity_line convergence_curve_global convergence_curve_iter
  1536. display_exercise = str2double( get(handles.edit39,'string') );
  1537. exercise_num = str2double( get(handles.edit18,'string') );
  1538. if display_exercise>exercise_num
  1539. % disp()
  1540. set(handles.edit38,'string','您设置的显示次数已超过最大值');
  1541. else
  1542. set(handles.edit38,'string','马上显示');
  1543. end
  1544. routes = path_node{1,display_exercise};
  1545. diversity = diversity_line{display_exercise,1};
  1546. convergence_global = convergence_curve_global{display_exercise,1};
  1547. convergence_iter = convergence_curve_iter{display_exercise,1};
  1548. [marker_algorithm] = marker_algorithm_function(hObject, eventdata, handles);
  1549. figure_path(routes,marker_algorithm,hObject, eventdata, handles);
  1550. figure_diversity_line(diversity,handles);
  1551. figure_convergence (convergence_global,convergence_iter,handles)
  1552. set(handles.radiobutton310,'value',1);
  1553. % --- Executes when selected object is changed in uipanel18.
  1554. function uipanel18_SelectionChangeFcn(hObject, eventdata, handles)
  1555. % hObject handle to the selected object in uipanel18
  1556. % eventdata structure with the following fields (see UIBUTTONGROUP)
  1557. % EventName: string 'SelectionChanged' (read only)
  1558. % OldValue: handle of the previously selected object or empty if none was selected
  1559. % NewValue: handle of the currently selected object
  1560. % handles structure with handles and user data (see GUIDATA)
  1561. global convergence_curve_global convergence_curve_iter
  1562. times_displace = str2double( get(handles.edit39,'string') );
  1563. convergence_global = convergence_curve_global{times_displace,1};
  1564. convergence_iter = convergence_curve_iter{times_displace,1};
  1565. switch get(handles.uipanel18,'SelectedObject')
  1566. case handles.radiobutton11
  1567. figure_convergence_iter (convergence_iter,handles)
  1568. case handles.radiobutton12
  1569. figure_convergence_global (convergence_global,handles)
  1570. case handles.radiobutton310
  1571. figure_convergence (convergence_global,convergence_iter,handles)
  1572. end
  1573. function edit52_Callback(hObject, eventdata, handles)
  1574. % hObject handle to edit52 (see GCBO)
  1575. % eventdata reserved - to be defined in a future version of MATLAB
  1576. % handles structure with handles and user data (see GUIDATA)
  1577. % Hints: get(hObject,'String') returns contents of edit52 as text
  1578. % str2double(get(hObject,'String')) returns contents of edit52 as a double
  1579. % --- Executes during object creation, after setting all properties.
  1580. function edit52_CreateFcn(hObject, eventdata, handles)
  1581. % hObject handle to edit52 (see GCBO)
  1582. % eventdata reserved - to be defined in a future version of MATLAB
  1583. % handles empty - handles not created until after all CreateFcns called
  1584. % Hint: edit controls usually have a white background on Windows.
  1585. % See ISPC and COMPUTER.
  1586. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1587. set(hObject,'BackgroundColor','white');
  1588. end
  1589. % --- Executes on button press in radiobutton21.
  1590. function radiobutton21_Callback(hObject, eventdata, handles)
  1591. % hObject handle to radiobutton21 (see GCBO)
  1592. % eventdata reserved - to be defined in a future version of MATLAB
  1593. % handles structure with handles and user data (see GUIDATA)
  1594. % Hint: get(hObject,'Value') returns toggle state of radiobutton21
  1595. function edit53_Callback(hObject, eventdata, handles)
  1596. % hObject handle to edit53 (see GCBO)
  1597. % eventdata reserved - to be defined in a future version of MATLAB
  1598. % handles structure with handles and user data (see GUIDATA)
  1599. % Hints: get(hObject,'String') returns contents of edit53 as text
  1600. % str2double(get(hObject,'String')) returns contents of edit53 as a double
  1601. % --- Executes during object creation, after setting all properties.
  1602. function edit53_CreateFcn(hObject, eventdata, handles)
  1603. % hObject handle to edit53 (see GCBO)
  1604. % eventdata reserved - to be defined in a future version of MATLAB
  1605. % handles empty - handles not created until after all CreateFcns called
  1606. % Hint: edit controls usually have a white background on Windows.
  1607. % See ISPC and COMPUTER.
  1608. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1609. set(hObject,'BackgroundColor','white');
  1610. end
  1611. % --- Executes on button press in radiobutton22.
  1612. function radiobutton22_Callback(hObject, eventdata, handles)
  1613. % hObject handle to radiobutton22 (see GCBO)
  1614. % eventdata reserved - to be defined in a future version of MATLAB
  1615. % handles structure with handles and user data (see GUIDATA)
  1616. % Hint: get(hObject,'Value') returns toggle state of radiobutton22
  1617. function edit54_Callback(hObject, eventdata, handles)
  1618. % hObject handle to edit54 (see GCBO)
  1619. % eventdata reserved - to be defined in a future version of MATLAB
  1620. % handles structure with handles and user data (see GUIDATA)
  1621. % Hints: get(hObject,'String') returns contents of edit54 as text
  1622. % str2double(get(hObject,'String')) returns contents of edit54 as a double
  1623. % --- Executes during object creation, after setting all properties.
  1624. function edit54_CreateFcn(hObject, eventdata, handles)
  1625. % hObject handle to edit54 (see GCBO)
  1626. % eventdata reserved - to be defined in a future version of MATLAB
  1627. % handles empty - handles not created until after all CreateFcns called
  1628. % Hint: edit controls usually have a white background on Windows.
  1629. % See ISPC and COMPUTER.
  1630. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1631. set(hObject,'BackgroundColor','white');
  1632. end
  1633. % --- Executes on button press in radiobutton23.
  1634. function radiobutton23_Callback(hObject, eventdata, handles)
  1635. % hObject handle to radiobutton23 (see GCBO)
  1636. % eventdata reserved - to be defined in a future version of MATLAB
  1637. % handles structure with handles and user data (see GUIDATA)
  1638. % Hint: get(hObject,'Value') returns toggle state of radiobutton23
  1639. function edit55_Callback(hObject, eventdata, handles)
  1640. % hObject handle to edit55 (see GCBO)
  1641. % eventdata reserved - to be defined in a future version of MATLAB
  1642. % handles structure with handles and user data (see GUIDATA)
  1643. % Hints: get(hObject,'String') returns contents of edit55 as text
  1644. % str2double(get(hObject,'String')) returns contents of edit55 as a double
  1645. % --- Executes during object creation, after setting all properties.
  1646. function edit55_CreateFcn(hObject, eventdata, handles)
  1647. % hObject handle to edit55 (see GCBO)
  1648. % eventdata reserved - to be defined in a future version of MATLAB
  1649. % handles empty - handles not created until after all CreateFcns called
  1650. % Hint: edit controls usually have a white background on Windows.
  1651. % See ISPC and COMPUTER.
  1652. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1653. set(hObject,'BackgroundColor','white');
  1654. end
  1655. % --- Executes on button press in radiobutton24.
  1656. function radiobutton24_Callback(hObject, eventdata, handles)
  1657. % hObject handle to radiobutton24 (see GCBO)
  1658. % eventdata reserved - to be defined in a future version of MATLAB
  1659. % handles structure with handles and user data (see GUIDATA)
  1660. % Hint: get(hObject,'Value') returns toggle state of radiobutton24
  1661. function edit56_Callback(hObject, eventdata, handles)
  1662. % hObject handle to edit56 (see GCBO)
  1663. % eventdata reserved - to be defined in a future version of MATLAB
  1664. % handles structure with handles and user data (see GUIDATA)
  1665. % Hints: get(hObject,'String') returns contents of edit56 as text
  1666. % str2double(get(hObject,'String')) returns contents of edit56 as a double
  1667. % --- Executes during object creation, after setting all properties.
  1668. function edit56_CreateFcn(hObject, eventdata, handles)
  1669. % hObject handle to edit56 (see GCBO)
  1670. % eventdata reserved - to be defined in a future version of MATLAB
  1671. % handles empty - handles not created until after all CreateFcns called
  1672. % Hint: edit controls usually have a white background on Windows.
  1673. % See ISPC and COMPUTER.
  1674. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1675. set(hObject,'BackgroundColor','white');
  1676. end
  1677. % --- Executes on button press in radiobutton25.
  1678. function radiobutton25_Callback(hObject, eventdata, handles)
  1679. % hObject handle to radiobutton25 (see GCBO)
  1680. % eventdata reserved - to be defined in a future version of MATLAB
  1681. % handles structure with handles and user data (see GUIDATA)
  1682. % Hint: get(hObject,'Value') returns toggle state of radiobutton25
  1683. % --- Executes on button press in pushbutton22.
  1684. function pushbutton22_Callback(hObject, eventdata, handles)
  1685. % hObject handle to pushbutton22 (see GCBO)
  1686. % eventdata reserved - to be defined in a future version of MATLAB
  1687. % handles structure with handles and user data (see GUIDATA)
  1688. function edit57_Callback(hObject, eventdata, handles)
  1689. % hObject handle to edit57 (see GCBO)
  1690. % eventdata reserved - to be defined in a future version of MATLAB
  1691. % handles structure with handles and user data (see GUIDATA)
  1692. % Hints: get(hObject,'String') returns contents of edit57 as text
  1693. % str2double(get(hObject,'String')) returns contents of edit57 as a double
  1694. % --- Executes during object creation, after setting all properties.
  1695. function edit57_CreateFcn(hObject, eventdata, handles)
  1696. % hObject handle to edit57 (see GCBO)
  1697. % eventdata reserved - to be defined in a future version of MATLAB
  1698. % handles empty - handles not created until after all CreateFcns called
  1699. % Hint: edit controls usually have a white background on Windows.
  1700. % See ISPC and COMPUTER.
  1701. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1702. set(hObject,'BackgroundColor','white');
  1703. end
  1704. % --- Executes on button press in radiobutton26.
  1705. function radiobutton26_Callback(hObject, eventdata, handles)
  1706. % hObject handle to radiobutton26 (see GCBO)
  1707. % eventdata reserved - to be defined in a future version of MATLAB
  1708. % handles structure with handles and user data (see GUIDATA)
  1709. % Hint: get(hObject,'Value') returns toggle state of radiobutton26
  1710. function edit58_Callback(hObject, eventdata, handles)
  1711. % hObject handle to edit58 (see GCBO)
  1712. % eventdata reserved - to be defined in a future version of MATLAB
  1713. % handles structure with handles and user data (see GUIDATA)
  1714. % Hints: get(hObject,'String') returns contents of edit58 as text
  1715. % str2double(get(hObject,'String')) returns contents of edit58 as a double
  1716. % --- Executes during object creation, after setting all properties.
  1717. function edit58_CreateFcn(hObject, eventdata, handles)
  1718. % hObject handle to edit58 (see GCBO)
  1719. % eventdata reserved - to be defined in a future version of MATLAB
  1720. % handles empty - handles not created until after all CreateFcns called
  1721. % Hint: edit controls usually have a white background on Windows.
  1722. % See ISPC and COMPUTER.
  1723. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1724. set(hObject,'BackgroundColor','white');
  1725. end
  1726. % --- Executes on button press in radiobutton27.
  1727. function radiobutton27_Callback(hObject, eventdata, handles)
  1728. % hObject handle to radiobutton27 (see GCBO)
  1729. % eventdata reserved - to be defined in a future version of MATLAB
  1730. % handles structure with handles and user data (see GUIDATA)
  1731. % Hint: get(hObject,'Value') returns toggle state of radiobutton27
  1732. function edit59_Callback(hObject, eventdata, handles)
  1733. % hObject handle to edit59 (see GCBO)
  1734. % eventdata reserved - to be defined in a future version of MATLAB
  1735. % handles structure with handles and user data (see GUIDATA)
  1736. % Hints: get(hObject,'String') returns contents of edit59 as text
  1737. % str2double(get(hObject,'String')) returns contents of edit59 as a double
  1738. % --- Executes during object creation, after setting all properties.
  1739. function edit59_CreateFcn(hObject, eventdata, handles)
  1740. % hObject handle to edit59 (see GCBO)
  1741. % eventdata reserved - to be defined in a future version of MATLAB
  1742. % handles empty - handles not created until after all CreateFcns called
  1743. % Hint: edit controls usually have a white background on Windows.
  1744. % See ISPC and COMPUTER.
  1745. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1746. set(hObject,'BackgroundColor','white');
  1747. end
  1748. % --- Executes on button press in radiobutton28.
  1749. function radiobutton28_Callback(hObject, eventdata, handles)
  1750. % hObject handle to radiobutton28 (see GCBO)
  1751. % eventdata reserved - to be defined in a future version of MATLAB
  1752. % handles structure with handles and user data (see GUIDATA)
  1753. % Hint: get(hObject,'Value') returns toggle state of radiobutton28
  1754. function edit60_Callback(hObject, eventdata, handles)
  1755. % hObject handle to edit60 (see GCBO)
  1756. % eventdata reserved - to be defined in a future version of MATLAB
  1757. % handles structure with handles and user data (see GUIDATA)
  1758. % Hints: get(hObject,'String') returns contents of edit60 as text
  1759. % str2double(get(hObject,'String')) returns contents of edit60 as a double
  1760. % --- Executes during object creation, after setting all properties.
  1761. function edit60_CreateFcn(hObject, eventdata, handles)
  1762. % hObject handle to edit60 (see GCBO)
  1763. % eventdata reserved - to be defined in a future version of MATLAB
  1764. % handles empty - handles not created until after all CreateFcns called
  1765. % Hint: edit controls usually have a white background on Windows.
  1766. % See ISPC and COMPUTER.
  1767. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1768. set(hObject,'BackgroundColor','white');
  1769. end
  1770. % --- Executes on button press in radiobutton29.
  1771. function radiobutton29_Callback(hObject, eventdata, handles)
  1772. % hObject handle to radiobutton29 (see GCBO)
  1773. % eventdata reserved - to be defined in a future version of MATLAB
  1774. % handles structure with handles and user data (see GUIDATA)
  1775. % Hint: get(hObject,'Value') returns toggle state of radiobutton29
  1776. function edit61_Callback(hObject, eventdata, handles)
  1777. % hObject handle to edit61 (see GCBO)
  1778. % eventdata reserved - to be defined in a future version of MATLAB
  1779. % handles structure with handles and user data (see GUIDATA)
  1780. % Hints: get(hObject,'String') returns contents of edit61 as text
  1781. % str2double(get(hObject,'String')) returns contents of edit61 as a double
  1782. % --- Executes during object creation, after setting all properties.
  1783. function edit61_CreateFcn(hObject, eventdata, handles)
  1784. % hObject handle to edit61 (see GCBO)
  1785. % eventdata reserved - to be defined in a future version of MATLAB
  1786. % handles empty - handles not created until after all CreateFcns called
  1787. % Hint: edit controls usually have a white background on Windows.
  1788. % See ISPC and COMPUTER.
  1789. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1790. set(hObject,'BackgroundColor','white');
  1791. end
  1792. % --- Executes on button press in radiobutton30.
  1793. function radiobutton30_Callback(hObject, eventdata, handles)
  1794. % hObject handle to radiobutton30 (see GCBO)
  1795. % eventdata reserved - to be defined in a future version of MATLAB
  1796. % handles structure with handles and user data (see GUIDATA)
  1797. % Hint: get(hObject,'Value') returns toggle state of radiobutton30
  1798. % --- Executes on button press in pushbutton23.
  1799. function pushbutton23_Callback(hObject, eventdata, handles)
  1800. % hObject handle to pushbutton23 (see GCBO)
  1801. % eventdata reserved - to be defined in a future version of MATLAB
  1802. % handles structure with handles and user data (see GUIDATA)
  1803. % 判断需要进行哪几种算法
  1804. axes(handles.axes2)
  1805. cla reset
  1806. set(handles.axes2,'visible','off')
  1807. reason2_ACO = get(handles.radiobutton5,'value'); % ACS
  1808. if reason2_ACO==0
  1809. set(handles.edit57,'string',0)
  1810. end
  1811. reason2_AS = get(handles.radiobutton2,'value'); % AS
  1812. if reason2_AS==0
  1813. set(handles.edit58,'string',0)
  1814. end
  1815. reason2_ACS = get(handles.radiobutton1,'value'); % ACO
  1816. if reason2_ACS==0
  1817. set(handles.edit59,'string',0)
  1818. end
  1819. reason2_RAS = get(handles.radiobutton6,'value'); % RAS
  1820. if reason2_RAS==0
  1821. set(handles.edit60,'string',0)
  1822. end
  1823. reason2_EAS = get(handles.radiobutton7,'value'); % EAS
  1824. if reason2_EAS==0
  1825. set(handles.edit61,'string',0)
  1826. end
  1827. figure_multi_algorithm(hObject, eventdata, handles)
  1828. % --- Executes on button press in pushbutton24.
  1829. function pushbutton24_Callback(hObject, eventdata, handles)
  1830. % hObject handle to pushbutton24 (see GCBO)
  1831. % eventdata reserved - to be defined in a future version of MATLAB
  1832. % handles structure with handles and user data (see GUIDATA)
  1833. init_all(handles);
  1834. % --- Executes on button press in pushbutton27.
  1835. function pushbutton27_Callback(hObject, eventdata, handles)
  1836. % hObject handle to pushbutton27 (see GCBO)
  1837. % eventdata reserved - to be defined in a future version of MATLAB
  1838. % handles structure with handles and user data (see GUIDATA)
  1839. % [f,p]=uiputfile({'*.jpg'},'保存文件');
  1840. % str=strcat(p,f);
  1841. % axes(handles.axes1);
  1842. % pix=getframe(handles.axes1);
  1843. % save file1 pix
  1844. % saveas(pix,'路径规划图','emf')
  1845. % imwrite(pix.cdata,'路径规划图','jpg')
  1846. % set(gcf,'CurrentAxes',handles.axes1);
  1847. % pix=getimage(gcf);
  1848. % imwrite(pix,'路径规划图')
  1849. wait_me = waitbar(0,'正在保存');
  1850. for i=1:100
  1851. pause(0.0001);
  1852. waitbar(i/110,wait_me);
  1853. end
  1854. name = '路径规划图';
  1855. if exist(name)==0
  1856. mkdir(name);
  1857. end
  1858. cd('路径规划图')
  1859. new_f_handle=figure('visible','off');
  1860. new_axes=copyobj(handles.axes1,new_f_handle);
  1861. pix=getframe(gcf);
  1862. set(new_axes,'units','default','position','default');
  1863. myfile_time = datestr(now,30);
  1864. saveas(gca,['路径规划图',char(myfile_time)],'fig')
  1865. saveas(gca,['路径规划图',char(myfile_time)],'emf')
  1866. close(gcf)
  1867. cd ..
  1868. waitbar(0.99,wait_me);
  1869. delete(wait_me);
  1870. % delete(new_axes)
  1871. % imwrite(pix.cdata,'路径规划图','fig')
  1872. % [filename,pathname fileindex]=uiputfile({'*.jpg';'*.bmp'},'save picture as');
  1873. % --- Executes on button press in pushbutton28.
  1874. function pushbutton28_Callback(hObject, eventdata, handles)
  1875. % hObject handle to pushbutton28 (see GCBO)
  1876. % eventdata reserved - to be defined in a future version of MATLAB
  1877. % handles structure with handles and user data (see GUIDATA)
  1878. set(handles.edit38,'string','正在保存,请稍后');
  1879. wait_me = waitbar(0,'正在保存');
  1880. for i=1:100
  1881. pause(0.0001);
  1882. waitbar(i/110,wait_me);
  1883. end
  1884. global legend_end
  1885. name = '迭代曲线图';
  1886. if exist(name)==0
  1887. mkdir(name);
  1888. end
  1889. cd('迭代曲线图')
  1890. new_f_handle = figure('visible','off');
  1891. set(gcf, 'PaperPositionMode', 'auto');
  1892. new_axes = copyobj(handles.axes3,new_f_handle);
  1893. legend(legend_end);
  1894. pix = getframe(gcf);
  1895. set(new_axes,'units','default','position','default');
  1896. myfile_time = datestr(now,30);
  1897. saveas(gca,['迭代曲线图',char(myfile_time)],'fig')
  1898. saveas(gca,['迭代曲线图',char(myfile_time)],'emf')
  1899. close(gcf)
  1900. cd ..
  1901. set(handles.edit38,'string','保存成功');
  1902. waitbar(0.99,wait_me);
  1903. delete(wait_me);
  1904. % --- Executes on button press in pushbutton29.
  1905. function pushbutton29_Callback(hObject, eventdata, handles)
  1906. % hObject handle to pushbutton29 (see GCBO)
  1907. % eventdata reserved - to be defined in a future version of MATLAB
  1908. % handles structure with handles and user data (see GUIDATA)
  1909. set(handles.edit38,'string','正在保存,请稍后');
  1910. wait_me = waitbar(0,'正在保存');
  1911. for i=1:100
  1912. pause(0.001);
  1913. waitbar(i/110,wait_me);
  1914. end
  1915. global reason
  1916. if reason==1
  1917. name = '同一算法的统计结果';
  1918. if exist(name)==0
  1919. mkdir(name);
  1920. end
  1921. cd('同一算法的统计结果')
  1922. handles_tmp = handles.uitable1;
  1923. data = get(handles_tmp,'data');
  1924. column_name = get(handles_tmp,'columnname');
  1925. row_name = get(handles_tmp,'rowname');
  1926. myfile_time = datestr(now,30);
  1927. filename = ['同一算法的统计结果',char(myfile_time)];
  1928. xlswrite(filename,column_name','sheet1','B1:D1');
  1929. xlswrite(filename,row_name,'sheet1','A2');
  1930. xlswrite(filename,data,'sheet1','B2');
  1931. cd ..
  1932. end
  1933. if reason==2
  1934. name = '不同算法的比较';
  1935. if exist(name)==0
  1936. mkdir(name);
  1937. end
  1938. cd('不同算法的比较')
  1939. handles_tmp = handles.uitable2;
  1940. data = get(handles_tmp,'data');
  1941. column_name = get(handles_tmp,'columnname');
  1942. row_name = get(handles_tmp,'rowname');
  1943. myfile_time = datestr(now,30);
  1944. filename = ['不同算法的统计结果',char(myfile_time)];
  1945. xlswrite(filename,column_name','sheet1','B1:F1');
  1946. xlswrite(filename,row_name,'sheet1','A2');
  1947. xlswrite(filename,data,'sheet1','B2');
  1948. cd ..
  1949. cd('不同算法的比较')
  1950. handles_tmp = handles.uitable3;
  1951. data = get(handles_tmp,'data');
  1952. column_name = get(handles_tmp,'columnname');
  1953. row_name = get(handles_tmp,'rowname');
  1954. myfile_time = datestr(now,30);
  1955. filename = ['不同算法的收敛值',char(myfile_time)];
  1956. xlswrite(filename,column_name','sheet1','B1:F1');
  1957. xlswrite(filename,row_name,'sheet1','A2');
  1958. xlswrite(filename,data,'sheet1','B2');
  1959. cd ..
  1960. cd('不同算法的比较')
  1961. handles_tmp = handles.uitable4;
  1962. data = get(handles_tmp,'data');
  1963. column_name = get(handles_tmp,'columnname');
  1964. row_name = get(handles_tmp,'rowname');
  1965. myfile_time = datestr(now,30);
  1966. filename = ['不同算法的收敛次数',char(myfile_time)];
  1967. xlswrite(filename,column_name','sheet1','B1:F1');
  1968. xlswrite(filename,row_name,'sheet1','A2');
  1969. xlswrite(filename,data,'sheet1','B2');
  1970. cd ..
  1971. end
  1972. set(handles.edit38,'string','保存成功');
  1973. waitbar(0.99,wait_me);
  1974. delete(wait_me);
  1975. % --- Executes on button press in pushbutton30.
  1976. function pushbutton30_Callback(hObject, eventdata, handles)
  1977. % hObject handle to pushbutton30 (see GCBO)
  1978. % eventdata reserved - to be defined in a future version of MATLAB
  1979. % handles structure with handles and user data (see GUIDATA)
  1980. set(handles.edit38,'string','正在保存,请稍后');
  1981. wait_me = waitbar(0,'正在保存');
  1982. for i=1:100
  1983. pause(0.0001);
  1984. waitbar(i/110,wait_me);
  1985. end
  1986. name = '多样性曲线图';
  1987. if exist(name)==0
  1988. mkdir(name);
  1989. end
  1990. cd('多样性曲线图')
  1991. new_f_handle=figure('visible','off');
  1992. new_axes=copyobj(handles.axes2,new_f_handle);
  1993. pix=getframe(gcf);
  1994. set(new_axes,'units','default','position','default');
  1995. myfile_time = datestr(now,30);
  1996. saveas(gca,['多样性曲线图',char(myfile_time)],'fig')
  1997. saveas(gca,['多样性曲线图',char(myfile_time)],'emf')
  1998. close(gcf)
  1999. cd ..
  2000. set(handles.edit38,'string','保存成功');
  2001. waitbar(0.99,wait_me);
  2002. delete(wait_me);
  2003. % --- Executes on button press in pushbutton31.
  2004. function pushbutton31_Callback(hObject, eventdata, handles)
  2005. % hObject handle to pushbutton31 (see GCBO)
  2006. % eventdata reserved - to be defined in a future version of MATLAB
  2007. % handles structure with handles and user data (see GUIDATA)
  2008. global permission_goal permission_start
  2009. permission_goal = 0;
  2010. permission_start = 0;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/819366
推荐阅读
相关标签
  

闽ICP备14008679号