資源簡介
C#遺傳算法代碼實例,有助于學習遺傳算法,了解遺傳算法的應用。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
//Download?by?http://www.codefans.net
namespace?main
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????int?_Max_Value?=?31;//定義域上界
????????int?_Min_Value?=?0;//定義域下界
????????int?_chrom_Len?=?5;//染色體長度
????????int?_G_size?=?30;
????????int?_Evolution_Times?=?20;
????????int?_p_det?=?1;
????????double?_Mutation_Rate?=?0.02;
????????string[]?_source_G_Only_One;
????????int?_flag_source_only?=?0;
????????string[]?_old_G;?
????????string[]?_seleted_G;?//選擇到的種群
????????string[]?_new_G;?//交叉后的下一代
????????int[]?_old_value;?
????????double[]?_old_p;
????????double?_best_p?=?0;
????????string?_best_Individual;
????????int?_p_times?=?0;
????????const?int?_p_rate?=?5;
????????string[]?_p1_data;
????????string[]?_p2_data;
????????string[]?_p3_data;
????????string[]?_p4_data;
????????string[]?_p5_data;
????????string[]?_p6_data;
????????string[]?_p7_data;
????????bool?_Flag_Can_Draw_P1?=?false;
????????bool?_Flag_Can_Draw_P2?=?false;
????????bool?_Flag_Can_Draw_P3?=?false;
????????bool?_Flag_Can_Draw_P4?=?false;
????????bool?_Flag_Can_Draw_P5?=?false;
????????bool?_Flag_Can_Draw_P6?=?false;
????????bool?_Flag_Can_Draw_P7?=?false;
????????string[]?_old_G_1;
????????string[]?_old_G_2;
????????string[]?_new_G_1;
????????string[]?_new_G_2;
????????string[]?_select_G_1;
????????string[]?_select_G_2;
????????int[]?_cross_proj;
????????double[]?_seed?=?new?double[100];
????????int?_k_seed?=?0;
????????double?_best_func?=?0;
????????string?_best_all?=?““;
????????string?str_goal=““;
????????int?_sum_time?=?0;
????????int?_sum_1?=?0;
????????int?_sum_2?=?0;
????????int?_sum_3?=?0;
????????int?_sum_4?=?0;
????????int?_sum_5?=?0;
????????int?_sum_6?=?0;
????????int?_sum_7?=?0;
????????//-----------------------------------------------------------------------------------------------------------
????????private?void?_Init_PictureBox(int?mode)
????????{
????????????//-----------------------------------------------
????????????if?(mode?==?1)
????????????{
????????????????_p1_data?=?new?string[_p_times?_G_size];
????????????????//
????????????????pictureBox1.Width?=?_p_rate?*?(_Max_Value?-?_Min_Value?+?2)?*?_p_times;
????????????????pictureBox1.Height?=?_p_rate?*?(_G_size?+?2);
????????????}
????????????//-----------------------------------------------
????????????if?(mode?==?2)
????????????{
????????????????_p2_data?=?new?string[_p_times?_G_size];
????????????????//
????????????????pictureBox2.Width?=?_p_rate?*?(_Max_Value?-?_Min_Value?+?2)?*?_p_times;
????????????????pictureBox2.Height?=?_p_rate?*?(_G_size?+?2);
????????????????pictureBox2.Left?=?pictureBox1.Left;
????????????????pictureBox2.Top?=?pictureBox1
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2077??2009-06-12?14:50??c#遺傳算法\www.wei2008.com.txt
?????文件???????3296??2009-04-11?02:58??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\bak.txt
?????文件??????43520??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\bin\Debug\main.exe
?????文件??????81408??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\bin\Debug\main.pdb
?????文件??????14328??2010-10-07?19:23??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\bin\Debug\main.vshost.exe
?????文件????????490??2007-07-21?01:33??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\bin\Debug\main.vshost.exe.manifest
?????文件??????72750??2010-02-06?16:59??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form1.cs
?????文件??????31387??2009-04-20?21:30??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form1.Designer.cs
?????文件???????6012??2009-04-20?21:30??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form1.resx
?????文件???????3559??2010-02-06?16:59??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form_encode.cs
?????文件??????10454??2010-02-06?16:59??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form_encode.designer.cs
?????文件???????5814??2009-04-20?14:32??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Form_encode.resx
?????文件???????3858??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\main.csproj
?????文件???????1023??2010-10-07?19:23??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.csproj.FileListAbsolute.txt
?????文件????????911??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.csproj.GenerateResource.Cache
?????文件??????43520??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.exe
?????文件????????180??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.Form1.resources
?????文件????????180??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.Form_encode.resources
?????文件??????81408??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.pdb
?????文件????????180??2010-10-07?19:18??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\main.Properties.Resources.resources
?????文件???????4608??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????500??2010-02-06?16:59??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Program.cs
?????文件???????1198??2009-04-08?14:06??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Properties\AssemblyInfo.cs
?????文件???????2832??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Properties\Resources.Designer.cs
?????文件???????5612??2009-04-08?14:06??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Properties\Resources.resx
?????文件???????1102??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Properties\Settings.Designer.cs
?????文件????????249??2009-04-08?14:06??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main\Properties\Settings.settings
?????文件????????902??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main.sln
?????文件??????23040??2010-10-07?19:23??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\main.suo
?????文件???????4723??2010-10-07?19:17??c#遺傳算法\常用的7種C#遺傳算法源碼實例集\ga1\UpgradeLog.xm
............此處省略77個文件信息
評論
共有 條評論