資源簡介
遺傳算法求TSP的C#界面版源碼,求解思路和 http://blog.csdn.net/wangqiuyun/article/details/12838903 這篇文章思路是一樣的,只是用C#改寫了,加入多線程和winform的展示。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?System.Threading;
namespace?TspGA
{
????public?partial?class?frmGa?:?Form
????{
????????Bitmap?image;
????????Graphics?formGraphics;
????????int?cityNum;
????????static?int[]?x;
????????static?int[]?y;
????????static?double?Max_ratio;//圖像放大比率
????????public?frmGa()
????????{
????????????InitializeComponent();
????????}
????????public?void?readTxt(string?filename)
????????{
????????????x?=?new?int[cityNum];
????????????y?=?new?int[cityNum];
????????????int?i?=?0;
????????????using?(StreamReader?sr?=?new?StreamReader(filename))
????????????{
????????????????string?line;
????????????????while?((line?=?sr.ReadLine())?!=?null)
????????????????{
????????????????????//this.ListBox1.Items.Add(“line?“);???//讀出
????????????????????//?字符分割??
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????117??2013-11-12?08:30??TspGA\TspGA\app.config
?????文件????????649??2012-09-26?10:40??TspGA\TspGA\bin\Debug\data.txt
?????文件?????346624??2013-11-12?08:31??TspGA\TspGA\bin\Debug\TspGA.exe
?????文件????????117??2013-11-12?08:30??TspGA\TspGA\bin\Debug\TspGA.exe.config
?????文件??????44544??2013-11-12?08:31??TspGA\TspGA\bin\Debug\TspGA.pdb
?????文件??????11608??2013-11-12?08:31??TspGA\TspGA\bin\Debug\TspGA.vshost.exe
?????文件????????117??2013-11-12?08:30??TspGA\TspGA\bin\Debug\TspGA.vshost.exe.config
?????文件????????649??2012-09-26?10:40??TspGA\TspGA\bin\Release\data.txt
?????文件?????345600??2013-11-12?08:31??TspGA\TspGA\bin\Release\TspGA.exe
?????文件????????117??2013-11-12?08:30??TspGA\TspGA\bin\Release\TspGA.exe.config
?????文件??????40448??2013-11-12?08:31??TspGA\TspGA\bin\Release\TspGA.pdb
?????文件??????11608??2013-11-12?08:31??TspGA\TspGA\bin\Release\TspGA.vshost.exe
?????文件????????117??2013-11-12?08:30??TspGA\TspGA\bin\Release\TspGA.vshost.exe.config
?????文件????????490??2010-03-17?22:39??TspGA\TspGA\bin\Release\TspGA.vshost.exe.manifest
?????文件???????9603??2013-11-12?08:30??TspGA\TspGA\frmGa.cs
?????文件??????14213??2013-11-12?08:30??TspGA\TspGA\frmGa.Designer.cs
?????文件?????248909??2013-11-12?08:30??TspGA\TspGA\frmGa.resx
?????文件??????19936??2013-11-07?21:27??TspGA\TspGA\ga.cs
?????文件?????161862??2013-11-12?08:29??TspGA\TspGA\ico.ico
?????文件???????4440??2013-11-06?20:26??TspGA\TspGA\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6070??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????856??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
?????文件????????450??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
?????文件??????????2??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件??????????2??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件???????7897??2013-11-07?14:57??TspGA\TspGA\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件???????4608??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????735??2013-11-12?08:32??TspGA\TspGA\obj\x86\Debug\TspGA.csproj.FileListAbsolute.txt
?????文件?????346624??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\TspGA.exe
?????文件?????162428??2013-11-12?08:31??TspGA\TspGA\obj\x86\Debug\TspGA.frmGa.resources
............此處省略37個文件信息
- 上一篇:c# 局域網聊天 仿飛秋和飛鴿傳書
- 下一篇:C#最小二乘法擬合及曲線繪制
評論
共有 條評論