資源簡介
基于蟻群算法實現的多機器人路徑規劃!

代碼片段和文件信息
%Dynamic?env
total?=?10;?????%?no?of?ants
iterations?=?1000;????%no.?of?iterations
phera_up?=?-1;
rho?=?0.8;
alpha?=?1;
beta?=?0;
%?initialization?of?env
mat?=?ones(250250);
path?=?ones(250250);
goal?=?[0?0];
[env?goal]?=?env_dy(mat0goal);
goal_a?=?zeros(12);
reached?=?-1;
reached_count?=?0;
figure(1);
????????%?Initialization?of?ants
ant?=?zeros(totaliterations2);?
ant_sta?=?zeros(total2);
ant(:1:)?=?1;
ant_sta(:1)?=?1;
phera?=?zeros(250250);
????????%?Iterations
li?=1:8;?
lm?=?[0?-1;1?-1;1?0;1?1;0?1;-1?1;-1?0;-1?-1];
lm?=?lm?*?5;
filter?=?ones(55)?*?0.25;???????????%gausian?filter?of?size?3
filter(2:42:4)?=?ones(33)?*?0.5;
filter(33)?=?1;
for?i?=?1:iterations
????for?j?=?1:total
???????if(ant_sta(j2)?==?1)
???????????continue;
???????end
???????min?=?-500;?
???????r_temp?=?ant(jant_sta(j1)1);
???????c_temp?=?ant(jant_sta(j1)2);
???????l?=?li(randperm(8));
???????for?ll?=?1:8
??????????????r?=?ant(jant_sta(j1)1)+lm(l(ll)1);
??????????????c?=?ant(jant_sta(j1)2)+lm(l(ll)2);
??????????????if(r?<=?0?||?c?<=?0?||?r?>=?251?||?c?>=?251?)
?????????????????continue;?
??????????????end
??????????????
??????????????if(r>=goal(1)-1?&&?r<=goal(1)+10?&&?c>=goal(2)-1?&&?c<=goal(2)+10)??????????%Goal?Test
??????????????????ant_sta(j2)?=?1;
??????????????????r_temp?=?goal(1);
??????????????????c_temp?=?goal(2);
??????????????????goal_a(1)?=?r;
??????????????????goal_a(2)?=?c;
??????????????????reached_count?=?reached_count?+?1;
??????????????????if(reached?==?-1)
????????????????????rho?=?0.8;
????????????????????reached?=?1;
????????????????????beta?=?0;
????????????????????alpha?=?1;
??????????????????end
??????????????????for?b=1:ant_sta(j1)
??????????????????????a?=?ant_sta(j1)?+?1?-b;
???????????????????????if(ant(ja1)?<=10?||?ant(ja2)?<=10?||ant(ja1)?>=?241?||?ant(ja2)?>=?241?)
???????????????????????????phera(ant(ja1)ant(ja2))?=?max(phera(ant(ja1)ant(ja2))??1/b);
???????????????????????else
??????????????????????????temp_mat?=?filter*(1/b);
??????????????????????????for?u?=?1:5
?????????????????????????????for?v?=?1:5
????????????????????????????????phera(ant(ja1)-15+5*uant(ja2)-15+5*v)?=?max(phera(ant(ja1)-15+5*uant(ja2)-15+5*v)??temp_mat(uv));
?????????????????????????????end
??????????????????????????end
???????????????????????end???????????????
??????????????????end?????????????????
??????????????????break;
??????????????end
??????????????
??????????????if(?env(rc)?==?1)
??????????????????trans?=?(phera(rc)/abs(phera(rc)))*(abs(phera(rc))^alpha)/(((sqrt((goal_a(1)-r)^2+(goal_a(2)-c)^2)+1))^beta);
??????????????????if(trans?????????????????????continue;
??????????????????end
??????????????????min?=?trans;
??????????????????r_temp?=?r;
??????????????????c_temp?=?c;
??????????????end
???????end
???????env(ant(jant_sta(j1)1)ant(jant_sta(j1)2))?=?1;
???????env(r_tempc_temp)?=?0;
???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.......??????8014??2016-03-31?21:27??multi_robot_navigation-ACO-master\code.m
????.......???????806??2016-03-31?21:27??multi_robot_navigation-ACO-master\env_dy.m
????.......???????335??2016-03-31?21:27??multi_robot_navigation-ACO-master\README.md
?????目錄??????????0??2016-03-31?21:27??multi_robot_navigation-ACO-master
-----------?---------??----------?-----??----
?????????????????9155????????????????????4
- 上一篇:Windows窗口焦點檢測器
- 下一篇:基于蟻群算法的路徑規劃
評論
共有 條評論