资源简介
蚁群算法工具箱蚁群算法资料:蚁群算法工具箱蚁群算法资料:蚁群算法工具箱蚁群算法资料:蚁群算法工具箱蚁群算法资料:蚁群算法工具蚁群算法工具箱蚁群算法资料:箱蚁群算法资料:蚁群算法工具蚁群算法工具箱蚁群算法资料:箱蚁群算法资料:蚁群算法工具箱蚁群算法资料:蚁群算法工具箱蚁群算法资料:
代码片段和文件信息
function [messageresultstimeElapsed] = runcontest(drawboard)
%RUNCONTEST Test an entry.
% [MESSAGERESULTSTIME] = RUNCONTEST(DRAWBOARD) runs the M-file
% solver.m against all the problems defined in testsuite_sample.mat. The
% input DRAWBOARD specifies if you want to graphically visualize the results.
% MESSAGE returns a summary of the testing. RESULTS measures how well the
% entry solved the problem and TIME measures the time the entry took to
% compute its answer.
% Argument parsing.
if (nargin < 1)
drawboard = 0;
end
% Define constants.
scentDecay = 1;
range = -2:2;
load testsuite_sample testsuite
% Run the submission for each problem in the suite.
score = zeros(size(testsuite));
time0 = cputime;
for i = 1: numel(testsuite)
main = testsuite(i).main;
food = testsuite(i).food;
scent = testsuite(i).scent;
ants = testsuite(i).ants;
locs = testsuite(i).locs;
if drawboard viewsolution(mainscentfoodlocs1); end
nAnts = sum(ants(:));
for timeCtr = 1:1000
for antCtr = 1:nAnts
y = locs(antCtr1);
x = locs(antCtr2);
yv = y + range;
xv = x + range;
mainMap = main(yvxv);
foodMap = food(yvxv);
antMap = ants(yvxv);
scentMap = scent(yvxv);
% call ant micro-program
clear global
[dydxmarkcarry] = solver(mainMapfoodMapantMapscentMap);
% figure out the new ant position
ny = y;
nx = x;
if dy>0
ny = ny+1;
elseif dy<0
ny = ny-1;
end
if dx>0
nx = nx+1;
elseif dx<0
nx = nx-1;
end
% validate move
if main(nynx)<0
ny = y;
nx = x;
end
% move food when carry is true
if carry & food(yx)
food(yx) = food(yx) -1;
food(nynx) = food(nynx)+1;
end
% leave scent
mark = min(max(real(round(mark))0)100);
if mark
scent(yx) = scent(yx)+mark;
end
% move ant
locs(antCtr:)=[ny nx];
ants(yx) = ants(yx) -1;
ants(nynx) = ants(nynx)+1;
end % next ant
% time passes reduce scent
scent = max(0scent - scentDecay);
if drawboard
viewsolution(mainscentfoodlocs0)
drawnow
end
end % next time step
score(i) = grade(mainfood);
end % next problem in testsuite
% report the time
timeElapsed = cputime-time0;
if drawboard
% time is not accurate when drawing the board
timeElapsed = NaN;
end
% Report results.
results = sum(score);
message =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 59512 2005-05-10 23:40 testsuite_sample.mat
文件 5091 2005-05-11 00:39 runcontest.m
文件 750 2005-05-11 00:33 solver.m
文件 68392 2005-05-19 23:10 testsuite_validation.mat
文件 58952 2005-05-10 23:40 testsuite_actual.mat
文件 5296 2005-05-19 23:12 runcontest_actual.m
- 上一篇:鲍德里亚 模拟物与拟像
- 下一篇:QQ自动回复机器人易语言源码
相关资源
- \\基于TSP问题的蚁群算法优化及并行策
- 蚁群算法的轨迹优化基于蚁群算法的
- 基于蚁群算法的海洋工程群项目资源
- 机械臂避障路径规划仿真 蚁群算法
- 蚁群算法实验室
- 基于蚁群算法的图像分割方法
- 基于蚁群算法的最优路径选择问题的
- 嵌入混沌的蚁群优化算法
- ACO蚁群算法解01背包问题
- 基于改进蚁群算法的纳什均衡求解
- 蚁群算法解决vrp问题
- 蚁群算法与遗传算法解决TSP问题
- 蚁群算法解决TSP问题的C实现代码直接
- path-planning 路径规划蚁群算法
- 最短路径搜索蚁群算法
- ACS蚁群算法求解TSP问题
- 蚁群算法与神经网络的融合
- 数学建模蚁群算法ppt
- 运筹学大作业,用五种算法解决经典
- 蚁群算法解决路径规划问题ant.doc
- 蚁群算法代码 TSP DataMining 车辆调度
- 很有趣的蚁群算法演示程序
- 蚁群算法 模拟蚁群算法 很不错
- 蚁群算法论文及源代码
评论
共有 条评论