91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

一個(gè)非常精美實(shí)用的蟻群算法演示程序,完整源代碼以及工程文件,以C#完成,建議VS打開,可debug內(nèi)直接exe運(yùn)行,要求NET Framework,非原創(chuàng),網(wǎng)絡(luò)范圍已有

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Drawing;

namespace?Ant
{
????class?Antc
????{
????????public?Antc(int?seed)
????????{
????????????NowLocation.X?=?PlayGround.HomeLocation.X;
????????????NowLocation.Y?=?PlayGround.HomeLocation.Y;
????????????//LastLocation.X?=?NowLocation.X;
????????????//LastLocation.Y?=?NowLocation.Y;
????????????ran?=?new?Random(seed);
????????????NowDirection?=?(AntDirection)?ran.Next(4)?+?1;?//?4:只使用4個(gè)方向,8:使用8個(gè)方向
????????????HomeSmellNum?=?MaxSmell;?//?螞蟻身上攜帶的Home信息素的數(shù)量
????????????FoodSmellNum?=?0;
????????????FoodNum?=?0;
????????????ClearTrace();
????????}

????????private?void?ClearTrace()
????????{
????????????for?(int?i?=?0;?i?????????????{
????????????????Trace[i].X?=?0;
????????????????Trace[i].Y?=?0;
????????????}
????????}

????????private?void?DropHomeSmell()
????????{
????????????if?(HomeSmellNum?<=?0)?return;
????????????int?groundsmell?=?PlayGround.HomeSmell[NowLocation.X?NowLocation.Y];
????????????int?smelldrop?=?(int)?(HomeSmellNum?*?SmellDropRate);
????????????if?(smelldrop?>?groundsmell)?PlayGround.HomeSmell[NowLocation.X?NowLocation.Y]?=?smelldrop;
????????????HomeSmellNum?-=?smelldrop;
????????????if?(HomeSmellNum?????????}

????????private?void?DropFoodSmell()
????????{
????????????if?(FoodSmellNum?<=?0)?return;
????????????int?groundsmell?=?PlayGround.FoodSmell[NowLocation.X?NowLocation.Y];
????????????int?smelldrop?=?(int)(FoodSmellNum?*?SmellDropRate);
????????????if?(smelldrop?>?groundsmell)?PlayGround.FoodSmell[NowLocation.X?NowLocation.Y]?=?smelldrop;
????????????FoodSmellNum?-=?smelldrop;
????????????if?(FoodSmellNum?????????}

????????public?void?AntOneStep()?
????????/*?1、決定調(diào)用函數(shù)決定螞蟻的下一步方向
?????????*?2、螞蟻移動(dòng)
?????????*?3、如果找到食物,或者回到窩,進(jìn)行響應(yīng)的處理
?????????*?4、釋放信息素
?????????*?5、記錄走過的路徑?
?????????*/
????????{
????????????AntDirection?ddir;
????????????int?tttx?ttty;

????????????tttx?=?NowLocation.X;
????????????ttty?=?NowLocation.Y;
????????????ddir?=?NowDirection;

????????????ddir?=?NextDirection(tttx?ttty?ddir);

????????????switch?(ddir)
????????????{
????????????????case?AntDirection.Up:?ttty--;
????????????????????break;
????????????????case?AntDirection.Down:?ttty++;
????????????????????break;
????????????????case?AntDirection.Left:?tttx--;
????????????????????break;
????????????????case?AntDirection.Right:?tttx++;
????????????????????break;
????????????????default:?break;
????????????}?/*?of?switch?dir?*/
????????????NowLocation.X?=?tttx;
????????????NowLocation.Y?=?ttty;
????????????NowDirection?=?ddir;

????????????//?窩處理
????????????if?(tttx?==?PlayGround.HomeLocation.X?&&?ttty?==?PlayGround.HomeLocation.Y)
????????????{
????????????????HomeSmellNum?=?MaxSmell;
????????????????ClearTrace();
????????????????if?(FoodNum?>?0)
????????????????{
????????????????????PlayGround.HomeNum?+=?Foo

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????3497??2012-06-19?00:26??蟻群算法演示\Ant\Ant\Ant.csproj

?????文件??????22007??2009-05-13?20:48??蟻群算法演示\Ant\Ant\Antc.cs

?????文件??????45056??2009-05-13?23:23??蟻群算法演示\Ant\Ant\bin\Debug\Ant.exe

?????文件??????14328??2012-06-19?00:27??蟻群算法演示\Ant\Ant\bin\Debug\Ant.vshost.exe

?????文件????????490??2009-06-11?05:14??蟻群算法演示\Ant\Ant\bin\Debug\Ant.vshost.exe.manifest

?????文件?????160054??2009-05-13?22:54??蟻群算法演示\Ant\Ant\bin\Debug\AntMap01.bmp

?????文件?????160054??2009-05-13?23:02??蟻群算法演示\Ant\Ant\bin\Debug\AntMap02.bmp

?????文件?????120054??2009-05-14?08:46??蟻群算法演示\Ant\Ant\bin\Debug\AntMap04.bmp

?????文件?????120054??2009-05-14?08:04??蟻群算法演示\Ant\Ant\bin\Debug\Matrix01.bmp

?????文件?????132774??2009-05-13?23:17??蟻群算法演示\Ant\Ant\bin\Debug\SizeError.bmp

?????文件???????1145??2009-05-13?23:25??蟻群算法演示\Ant\Ant\bin\Debug\版本說明.txt

?????文件???????7630??2009-05-14?14:18??蟻群算法演示\Ant\Ant\bin\Debug\群群算法.txt

?????文件??????24644??2009-05-13?23:23??蟻群算法演示\Ant\Ant\Form1.cs

?????文件??????25447??2009-05-13?23:23??蟻群算法演示\Ant\Ant\Form1.Designer.cs

?????文件???????6611??2009-05-13?23:23??蟻群算法演示\Ant\Ant\Form1.resx

?????文件???????4608??2012-06-19?00:27??蟻群算法演示\Ant\Ant\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

?????文件???????4645??2009-05-13?21:42??蟻群算法演示\Ant\Ant\PlayGround.cs

?????文件????????462??2009-05-10?21:19??蟻群算法演示\Ant\Ant\Program.cs

?????文件???????1154??2009-05-13?23:23??蟻群算法演示\Ant\Ant\Properties\AssemblyInfo.cs

?????文件???????2830??2012-06-19?00:26??蟻群算法演示\Ant\Ant\Properties\Resources.Designer.cs

?????文件???????5612??2009-05-10?21:19??蟻群算法演示\Ant\Ant\Properties\Resources.resx

?????文件???????1101??2012-06-19?00:26??蟻群算法演示\Ant\Ant\Properties\Settings.Designer.cs

?????文件????????249??2009-05-10?21:19??蟻群算法演示\Ant\Ant\Properties\Settings.settings

?????文件????????899??2012-06-19?00:26??蟻群算法演示\Ant\Ant.sln

?????文件???????2560??2012-06-19?00:30??蟻群算法演示\Ant\Ant.suo

?????文件????????948??2012-06-19?00:26??蟻群算法演示\Ant\UpgradeLog.xml

?????文件???????3348??2012-06-19?00:26??蟻群算法演示\Ant\_UpgradeReport_Files\UpgradeReport.css

?????文件??????12505??2008-01-11?01:25??蟻群算法演示\Ant\_UpgradeReport_Files\UpgradeReport.xslt

?????文件?????????69??2012-06-19?00:26??蟻群算法演示\Ant\_UpgradeReport_Files\UpgradeReport_Minus.gif

?????文件?????????71??2012-06-19?00:26??蟻群算法演示\Ant\_UpgradeReport_Files\UpgradeReport_Plus.gif

............此處省略13個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源