├── Nesil-sayisi-degistirilisi.jpg ├── Program Kodu ├── Resources │ └── kroki.png ├── bin │ └── Debug │ │ ├── YolBulma.exe │ │ ├── YolBulma.pdb │ │ ├── YolBulma.vshost.exe │ │ └── YolBulma.vshost.exe.manifest ├── obj │ └── x86 │ │ └── Debug │ │ ├── YolBulma.exe │ │ ├── YolBulma.pdb │ │ ├── YolBulma.Form1.resources │ │ ├── GenerateResource-ResGen.read.1.tlog │ │ ├── GenerateResource-ResGen.write.1.tlog │ │ ├── YolBulma.Properties.Resources.resources │ │ ├── TempPE │ │ └── Properties.Resources.Designer.cs.dll │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── YolveRotaPlanlama.csproj.FileListAbsolute.txt │ │ ├── YolBulma.csproj.FileListAbsolute.txt │ │ └── Noktadan Noktaya Yol ve Rota Planlama.csproj.FileListAbsolute.txt ├── Noktadan Noktaya Yol ve Rota Planlama.suo ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── Noktadan Noktaya Yol ve Rota Planlama.sln ├── Noktadan Noktaya Yol ve Rota Planlama.csproj ├── Form1.resx ├── Rotaizle.cs ├── Form1.Designer.cs └── Form1.cs ├── Genetik-Algoritma-ile-Rota-Bulma-Arayuz1.jpg ├── 1-24-arasi-elde-edilen-verilerin-Goruntusu.jpg ├── Rapor ├── Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).doc └── Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).pdf ├── LICENSE └── README.md /Nesil-sayisi-degistirilisi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Nesil-sayisi-degistirilisi.jpg -------------------------------------------------------------------------------- /Program Kodu/Resources/kroki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/Resources/kroki.png -------------------------------------------------------------------------------- /Program Kodu/bin/Debug/YolBulma.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/bin/Debug/YolBulma.exe -------------------------------------------------------------------------------- /Program Kodu/bin/Debug/YolBulma.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/bin/Debug/YolBulma.pdb -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolBulma.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/YolBulma.exe -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolBulma.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/YolBulma.pdb -------------------------------------------------------------------------------- /Program Kodu/bin/Debug/YolBulma.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/bin/Debug/YolBulma.vshost.exe -------------------------------------------------------------------------------- /Genetik-Algoritma-ile-Rota-Bulma-Arayuz1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Genetik-Algoritma-ile-Rota-Bulma-Arayuz1.jpg -------------------------------------------------------------------------------- /1-24-arasi-elde-edilen-verilerin-Goruntusu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/1-24-arasi-elde-edilen-verilerin-Goruntusu.jpg -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolBulma.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/YolBulma.Form1.resources -------------------------------------------------------------------------------- /Program Kodu/Noktadan Noktaya Yol ve Rota Planlama.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/Noktadan Noktaya Yol ve Rota Planlama.suo -------------------------------------------------------------------------------- /Rapor/Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Rapor/Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).doc -------------------------------------------------------------------------------- /Rapor/Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Rapor/Yol ve Rota Planlama ( Bülent SİYAH 081503030 ).pdf -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/GenerateResource-ResGen.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/GenerateResource-ResGen.read.1.tlog -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/GenerateResource-ResGen.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/GenerateResource-ResGen.write.1.tlog -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolBulma.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/YolBulma.Properties.Resources.resources -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bulentsiyah/Using-Genetic-Algorithm-the-road-to-Point-to-Point-and-Route-Planning/HEAD/Program Kodu/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /Program Kodu/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Program Kodu/bin/Debug/YolBulma.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Program Kodu/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace YolBulma 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new Form1()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolveRotaPlanlama.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.exe 2 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.pdb 3 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\ResolveAssemblyReference.cache 4 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Form1.resources 5 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Properties.Resources.resources 6 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 7 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 8 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.exe 9 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.pdb 10 | -------------------------------------------------------------------------------- /Program Kodu/Noktadan Noktaya Yol ve Rota Planlama.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noktadan Noktaya Yol ve Rota Planlama", "Noktadan Noktaya Yol ve Rota Planlama.csproj", "{36454CF0-FD97-4BB6-B826-F3DD62FC24CE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {36454CF0-FD97-4BB6-B826-F3DD62FC24CE}.Debug|x86.ActiveCfg = Debug|x86 13 | {36454CF0-FD97-4BB6-B826-F3DD62FC24CE}.Debug|x86.Build.0 = Debug|x86 14 | {36454CF0-FD97-4BB6-B826-F3DD62FC24CE}.Release|x86.ActiveCfg = Release|x86 15 | {36454CF0-FD97-4BB6-B826-F3DD62FC24CE}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Bulent SIYAH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Using Genetic Algorithm the road to Point-to-Point and Route Planning (C#) 2 | 3 | http://www.bulentsiyah.com/genetik-algoritma-kullanilarak-noktadan-noktaya-yol-ve-rota-planlama-csharp/ 4 | 5 | In this study, it is aimed to find the route and path between points on a sketch by genetic algorithm. Since the genetic algorithm is a random search method, it works on a solution set instead of looking for a single solution. The optimum solution is reached on some of the possible solutions. Thus, the results in the study are not always the best. The reason for using the genetic algorithm in the study is that the genetic algorithm does not need any information about the nature of the problem. Basically, the study, which is similar to the traveler salesman problem, is intended to be a solution for problems similar to the traveler seller problem. 6 | 7 | ![](https://github.com/bulentsiyah/Genetik-Algoritma-Kullanarak-Noktadan-Noktaya-Yol-ve-Rota-Planlama/blob/master/Nesil-sayisi-degistirilisi.jpg) 8 | 9 | ![](https://github.com/bulentsiyah/Genetik-Algoritma-Kullanarak-Noktadan-Noktaya-Yol-ve-Rota-Planlama/blob/master/1-24-arasi-elde-edilen-verilerin-Goruntusu.jpg) 10 | -------------------------------------------------------------------------------- /Program Kodu/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace YolBulma.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Program Kodu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("YolBulma")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("YolBulma")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1ab55b6f-439e-46ff-9f75-cac9d9021a26")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/YolBulma.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\ResolveAssemblyReference.cache 2 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\YolBulma.Form1.resources 3 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\YolBulma.Properties.Resources.resources 4 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 5 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 6 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\bin\Debug\YolBulma.exe 7 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\bin\Debug\YolBulma.pdb 8 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\YolBulma.exe 9 | C:\Users\Bulent\Documents\Visual Studio 2010\Projects\YolBulma\obj\x86\Debug\YolBulma.pdb 10 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.exe 11 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.pdb 12 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.exe 13 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.pdb 14 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\ResolveAssemblyReference.cache 15 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Form1.resources 16 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Properties.Resources.resources 17 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 18 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 19 | D:\p-DERSLER\.. AKADEMİK TAKVİM,DEVAMSIZLIK,KALANDERSLER,GEÇMİŞ DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.exe 20 | D:\p-DERSLER\.. AKADEMİK TAKVİM,DEVAMSIZLIK,KALANDERSLER,GEÇMİŞ DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.pdb 21 | -------------------------------------------------------------------------------- /Program Kodu/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace YolBulma.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("YolBulma.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | internal static System.Drawing.Bitmap kroki { 64 | get { 65 | object obj = ResourceManager.GetObject("kroki", resourceCulture); 66 | return ((System.Drawing.Bitmap)(obj)); 67 | } 68 | } 69 | 70 | internal static System.Drawing.Bitmap kroki1 { 71 | get { 72 | object obj = ResourceManager.GetObject("kroki1", resourceCulture); 73 | return ((System.Drawing.Bitmap)(obj)); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Program Kodu/Noktadan Noktaya Yol ve Rota Planlama.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {36454CF0-FD97-4BB6-B826-F3DD62FC24CE} 9 | WinExe 10 | Properties 11 | YolBulma 12 | YolBulma 13 | v3.5 14 | 512 15 | 16 | 17 | x86 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | x86 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Form 49 | 50 | 51 | Form1.cs 52 | 53 | 54 | 55 | 56 | 57 | Form1.cs 58 | 59 | 60 | ResXFileCodeGenerator 61 | Resources.Designer.cs 62 | Designer 63 | 64 | 65 | True 66 | Resources.resx 67 | True 68 | 69 | 70 | SettingsSingleFileGenerator 71 | Settings.Designer.cs 72 | 73 | 74 | True 75 | Settings.settings 76 | True 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /Program Kodu/obj/x86/Debug/Noktadan Noktaya Yol ve Rota Planlama.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.exe 2 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.pdb 3 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.exe 4 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\bin\Debug\YolBulma.pdb 5 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\ResolveAssemblyReference.cache 6 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Form1.resources 7 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\YolBulma.Properties.Resources.resources 8 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 9 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\YolBulma\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 10 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\YolBulma.exe 11 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\YolBulma.pdb 12 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\bin\Debug\YolBulma.exe 13 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\bin\Debug\YolBulma.pdb 14 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\ResolveAssemblyReference.cache 15 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\YolBulma.Form1.resources 16 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\YolBulma.Properties.Resources.resources 17 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 18 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CD\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 19 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\YolBulma.exe 20 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\YolBulma.pdb 21 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\bin\Debug\YolBulma.exe 22 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\bin\Debug\YolBulma.pdb 23 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\ResolveAssemblyReference.cache 24 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\YolBulma.Form1.resources 25 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\YolBulma.Properties.Resources.resources 26 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 27 | D:\p-DERSLER\Proje\F YAPAY ZEKA proje\CDbb\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 28 | D:\p-DERSLER\.. AKADEMİK TAKVİM,DEVAMSIZLIK,KALANDERSLER,GEÇMİŞ DERSLER\Proje\F YAPAY ZEKA proje\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.exe 29 | D:\p-DERSLER\.. AKADEMİK TAKVİM,DEVAMSIZLIK,KALANDERSLER,GEÇMİŞ DERSLER\Proje\F YAPAY ZEKA proje\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.pdb 30 | D:\p-3-PROGRAMLAMA\zz Yapay Zeka\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.exe 31 | D:\p-3-PROGRAMLAMA\zz Yapay Zeka\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.pdb 32 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.exe 33 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.pdb 34 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\bin\Debug\YolBulma.exe 35 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\bin\Debug\YolBulma.pdb 36 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\ResolveAssemblyReference.cache 37 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.Form1.resources 38 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\YolBulma.Properties.Resources.resources 39 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog 40 | D:\p-Yapay Zeka & Robotik\Genetik Algoritma\zz ARŞİV\Bülent SİYAH 081503030 ( YAPAY ZEKA PROJESİ )\Program Kodu\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog 41 | -------------------------------------------------------------------------------- /Program Kodu/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Kromozomlar ' Gerçek Değer Kodlama ' ile 20 gen olarak kodlanmıştır. 122 | Her populasyon varsayılan olarak 30 bireyden oluşur. 123 | Seçilim ikili turnuva seleksiyonu ile yapılmıştır. 124 | Elitizm (Seçkincilik) yapılarak en iyi birey yeni populasyona doğrudan aktarılmıştır. 125 | Çaprazlama rastgele bir lopustan ' Tek Noktalı ' olarak uygulanmıştır. 126 | Mutasyon çaprazlama ile yaratılan bireylere uygulanmıştır. 127 | Varsayılan Nesil sayısı 50 olarak belirlenmiştir. 128 | 129 | Genetik Algoritma ile Noktadan Noktaya Yol ve Rota Planlama ( Yapay Zeka Projesi | Bülent SİYAH | 2011) 130 | 131 | -------------------------------------------------------------------------------- /Program Kodu/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\kroki.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | 126 | ..\Resources\kroki.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 127 | 128 | -------------------------------------------------------------------------------- /Program Kodu/Rotaizle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Collections; 6 | 7 | namespace YolBulma 8 | { 9 | class Rotaizle 10 | { 11 | int[,] ilkToplum = new int[101, 21]; 12 | int[,] ToplumPozisyonu = new int[101, 21]; 13 | int[] ToplumBireyUzunlugu = new int[101]; 14 | int[] ToplumBireyUygunlugu = new int[101]; 15 | int[] DonenDeger = new int[21]; 16 | 17 | Hashtable hassecilen = new Hashtable(); 18 | 19 | int[] Secilenler = new int[101]; 20 | int EnKucuk = 10000; 21 | int EnKucukindex = 0; 22 | 23 | int[,] YeniToplum = new int[101, 21]; 24 | int[,] YeniToplumPozisyonu = new int[101, 21]; 25 | int[] YeniToplumBireyUygunlugu = new int[101]; 26 | int[] YeniToplumBireyUzunlugu = new int[101]; 27 | Random Sayi = new Random(); 28 | int[,] NoktaKoordinatlari = new int[25, 2]; 29 | int[,] SonucRota = new int[1, 22]; 30 | int[] RastgeleSecilenler = new int[101]; 31 | int[] eniyiler = new int[5]; 32 | int[] Deney2 = new int[101]; 33 | int[] Deney232 = new int[101]; 34 | public int[,] RotaGonder(int gNesilSayisi, int gilkNokta, int gSonNokta) 35 | { 36 | NoktaKoordinatlariYerlestir(); 37 | ToplumOlustur(gNesilSayisi);//100 bıreylı her bırey 20 kromozomlu 38 | ToplumUygunluk(gilkNokta, gSonNokta); //her bıreyın uygunlugu hesaplanıyor. 39 | ToplumSeckincilik();//en ıyı 4 tane secersecer ve yenı toplum ekler 40 | ToplumCaprazlama();//seckincilikle eklenenler dısında en uygunları caprazlayarak yenı topluma ekler. 41 | // ToplumCaprazlamaRastgele(); 42 | ToplumMutasyon(); 43 | YeniToplumUygunluk(gilkNokta, gSonNokta); 44 | ToplumDegistir(); 45 | return SonucRota; 46 | } 47 | public int[] Deney() 48 | { 49 | return Deney2; 50 | } 51 | public int[] Deney23() 52 | { 53 | return Deney232; 54 | } 55 | 56 | public void ToplumOlustur(int gNesilSayisi) 57 | { 58 | if (gNesilSayisi == 100)//ilk nesıl oldugunu anlarım 59 | { 60 | for (int i = 1; i <= 100; i++) 61 | { 62 | for (int j = 1; j <= 20; j++) 63 | { 64 | 65 | ilkToplum[i, j] = Sayi.Next(0, 4); 66 | } 67 | } 68 | SonucRota[0, 21] = 25; 69 | } 70 | else 71 | { 72 | 73 | } 74 | } 75 | public void ToplumDegistir() 76 | { 77 | //for (int ic = 1; ic < 5; ic++) 78 | //{ 79 | // for (int hh = 1; hh < 21; hh++) 80 | // { 81 | // //Deney232[ic, hh] = ilkToplum[ic, hh]; 82 | // ilkToplum[ic, hh] = YeniToplum[eniyiler[ic], hh]; 83 | // //Deney2[ic, hh] = YeniToplum[ic, hh]; 84 | // } 85 | //} 86 | for (int i = 1; i < 101; i++) 87 | { 88 | for (int h = 1; h < 21; h++) 89 | { 90 | //Deney232[i, h] = ilkToplum[i, h]; 91 | ilkToplum[i, h] = YeniToplum[i, h]; 92 | //Deney2[i, h] = YeniToplum[i, h]; 93 | } 94 | } 95 | Deney232 = ToplumBireyUygunlugu; 96 | Deney2 = YeniToplumBireyUygunlugu; 97 | } 98 | 99 | public void ToplumUygunluk(int gilkNokta, int gSonNokta) 100 | { 101 | int ilk = gilkNokta; 102 | int Son = gSonNokta; 103 | 104 | for (int i = 1; i <= 100; i++) 105 | { 106 | ilk = gilkNokta; 107 | Son = gSonNokta; 108 | ToplumBireyUzunlugu[i] = 0; 109 | for (int j = 1; j <= 20; j++) 110 | { 111 | DonenDeger[j] = ToplumUygunlukNoktasi(ilk, ilkToplum[i, j], Son, j); 112 | ToplumBireyUzunlugu[i] = ToplumBireyUzunlugu[i] + ToplumUygunlukNoktaMesafesi(ilk, DonenDeger[j]); 113 | ToplumPozisyonu[i, j] = DonenDeger[j]; 114 | ilk = DonenDeger[j]; 115 | if (j == 20) 116 | { 117 | ToplumBireyUygunlugu[i] = ToplumUygunlukNoktaMesafesi(DonenDeger[j], gSonNokta); 118 | ToplumBireyUygunlugu[i] = ToplumBireyUygunlugu[i] + ToplumBireyUzunlugu[i] / 2; 119 | } 120 | } 121 | } 122 | } 123 | public int ToplumUygunlukNoktasi(int gilkNokta, int gYon, int gSonNokta, int Sj) 124 | { 125 | int sonuc; 126 | if (gilkNokta == gSonNokta) 127 | { 128 | sonuc = gSonNokta; 129 | } 130 | else 131 | { 132 | if (gYon == 0 && !(gilkNokta == 1 || gilkNokta == 2 || gilkNokta == 3 || gilkNokta == 4)) 133 | { 134 | sonuc = gilkNokta - 4; 135 | } 136 | else if (gYon == 1 && !(gilkNokta == 1 || gilkNokta == 5 || gilkNokta == 9 || gilkNokta == 13 || gilkNokta == 17 || gilkNokta == 21)) 137 | { 138 | sonuc = gilkNokta - 1; 139 | } 140 | else if (gYon == 2 && !(gilkNokta == 21 || gilkNokta == 22 || gilkNokta == 23 || gilkNokta == 24)) 141 | { 142 | sonuc = gilkNokta + 4; 143 | } 144 | else if (gYon == 3 && !(gilkNokta == 4 || gilkNokta == 8 || gilkNokta == 12 || gilkNokta == 16 || gilkNokta == 20 || gilkNokta == 24)) 145 | { 146 | sonuc = gilkNokta + 1; 147 | } 148 | else 149 | { 150 | sonuc = gilkNokta; 151 | } 152 | } 153 | for (int j = 1; j <= Sj; j++) 154 | { 155 | if (sonuc == DonenDeger[j]) 156 | { 157 | sonuc = gilkNokta; 158 | } 159 | } 160 | return sonuc; 161 | 162 | } 163 | public int ToplumUygunlukNoktaMesafesi(int gilkNokta, int gDonenNokta) 164 | { 165 | double islem = Math.Pow(NoktaKoordinatlari[gilkNokta, 0] - NoktaKoordinatlari[gDonenNokta, 0], 2) + Math.Pow(NoktaKoordinatlari[gilkNokta, 1] - NoktaKoordinatlari[gDonenNokta, 1], 2); 166 | islem = Convert.ToInt32(Math.Sqrt(islem)); 167 | return (int)islem; 168 | } 169 | public void NoktaKoordinatlariYerlestir() 170 | { 171 | NoktaKoordinatlari[1, 0] = 50; 172 | NoktaKoordinatlari[1, 1] = 50; 173 | NoktaKoordinatlari[2, 0] = 50; 174 | NoktaKoordinatlari[2, 1] = 150; 175 | NoktaKoordinatlari[3, 0] = 50; 176 | NoktaKoordinatlari[3, 1] = 300; 177 | NoktaKoordinatlari[4, 0] = 50; 178 | NoktaKoordinatlari[4, 1] = 400; 179 | NoktaKoordinatlari[5, 0] = 150; 180 | NoktaKoordinatlari[5, 1] = 10; 181 | NoktaKoordinatlari[6, 0] = 100; 182 | NoktaKoordinatlari[6, 1] = 100; 183 | NoktaKoordinatlari[7, 0] = 130; 184 | NoktaKoordinatlari[7, 1] = 225; 185 | NoktaKoordinatlari[8, 0] = 130; 186 | NoktaKoordinatlari[8, 1] = 400; 187 | NoktaKoordinatlari[9, 0] = 220; 188 | NoktaKoordinatlari[9, 1] = 75; 189 | NoktaKoordinatlari[10, 0] = 235; 190 | NoktaKoordinatlari[10, 1] = 160; 191 | NoktaKoordinatlari[11, 0] = 200; 192 | NoktaKoordinatlari[11, 1] = 300; 193 | NoktaKoordinatlari[12, 0] = 190; 194 | NoktaKoordinatlari[12, 1] = 400; 195 | NoktaKoordinatlari[13, 0] = 350; 196 | NoktaKoordinatlari[13, 1] = 75; 197 | NoktaKoordinatlari[14, 0] = 375; 198 | NoktaKoordinatlari[14, 1] = 160; 199 | NoktaKoordinatlari[15, 0] = 450; 200 | NoktaKoordinatlari[15, 1] = 310; 201 | NoktaKoordinatlari[16, 0] = 475; 202 | NoktaKoordinatlari[16, 1] = 400; 203 | NoktaKoordinatlari[17, 0] = 450; 204 | NoktaKoordinatlari[17, 1] = 75; 205 | NoktaKoordinatlari[18, 0] = 500; 206 | NoktaKoordinatlari[18, 1] = 165; 207 | NoktaKoordinatlari[19, 0] = 510; 208 | NoktaKoordinatlari[19, 1] = 210; 209 | NoktaKoordinatlari[20, 0] = 500; 210 | NoktaKoordinatlari[20, 1] = 350; 211 | NoktaKoordinatlari[21, 0] = 600; 212 | NoktaKoordinatlari[21, 1] = 100; 213 | NoktaKoordinatlari[22, 0] = 600; 214 | NoktaKoordinatlari[22, 1] = 190; 215 | NoktaKoordinatlari[23, 0] = 600; 216 | NoktaKoordinatlari[23, 1] = 300; 217 | NoktaKoordinatlari[24, 0] = 600; 218 | NoktaKoordinatlari[24, 1] = 400; 219 | } 220 | public void ToplumSeckincilik() 221 | { 222 | 223 | //SortedDictionary siralayici = new SortedDictionary(); 224 | //for(int i=1; i<101; i++) 225 | // siralayici.Add(ToplumBireyUygunlugu[i],i); 226 | 227 | //for (int i = 1; i < 101; i++) 228 | // for (int j = 1; j < 21; j++) 229 | // YeniToplum[i, j] = ilkToplum[siralayici.ElementAt(i-1).Value,j]; 230 | 231 | for (int a = 1; a < 101; a++) 232 | { 233 | EnKucuk = 10000; 234 | EnKucukindex = 0; 235 | int gecici = 0, gecici2 = 0; 236 | for (int b = a; b < 101; b++) 237 | { 238 | if (ToplumBireyUygunlugu[b] < (EnKucuk)) 239 | { 240 | EnKucuk = ToplumBireyUygunlugu[b]; 241 | EnKucukindex = b; 242 | } 243 | } 244 | 245 | for (int b = 1; b < 21; b++) 246 | { 247 | gecici = ToplumBireyUygunlugu[a]; 248 | gecici2 = ilkToplum[a, b]; 249 | ToplumBireyUygunlugu[a] = ToplumBireyUygunlugu[EnKucukindex]; 250 | ilkToplum[a, b] = ilkToplum[EnKucukindex, b]; 251 | ToplumBireyUygunlugu[EnKucukindex] = gecici; 252 | ilkToplum[a, b] = gecici2; 253 | } 254 | } 255 | for (int index = 1; index < 101; index++) 256 | { 257 | for (int bb = 1; bb < 21; bb++) 258 | { 259 | YeniToplum[index, bb] = ilkToplum[index, bb]; 260 | } 261 | } 262 | 263 | 264 | 265 | } 266 | public void ToplumCaprazlama() 267 | { 268 | int geciciDeger = 0; 269 | for (int s = 5; s < 100; s++) 270 | { 271 | for (int b = 11; b < 21; b++) 272 | { 273 | geciciDeger = YeniToplum[s, b]; 274 | YeniToplum[s, b] = YeniToplum[s + 1, b]; 275 | YeniToplum[s + 1, b] = geciciDeger; 276 | } 277 | 278 | } 279 | } 280 | //public void ToplumCaprazlamaRastgele() 281 | //{ 282 | // Secilen = 1; 283 | // int rastgele, rastgele2; 284 | // int geciciDeger; 285 | 286 | 287 | // while (Secilen < 101) 288 | // { 289 | // rastgele = Sayi.Next(1, 101); 290 | // rastgele2 = Sayi.Next(1, 101); 291 | // for (int a = 1; a < Secilen; a++) 292 | // { 293 | // if ((Secilenler[a] == rastgele) || (Secilenler[a] == rastgele2)) 294 | // { 295 | // AyniindexVar = true; 296 | // } 297 | // } 298 | 299 | // if (!(AyniindexVar)) 300 | // { 301 | // for (int b = 11; b < 21; b++) 302 | // { 303 | // geciciDeger = YeniToplum[rastgele, b]; 304 | // YeniToplum[rastgele, b] = YeniToplum[rastgele2, b]; 305 | // YeniToplum[rastgele2, b] = geciciDeger; 306 | // } 307 | // RastgeleSecilenler[Secilen] = rastgele; 308 | // Secilen++; 309 | // RastgeleSecilenler[Secilen] = rastgele2; 310 | // Secilen++; 311 | 312 | // } 313 | 314 | // AyniindexVar = false; 315 | 316 | // } 317 | 318 | //} 319 | public void ToplumMutasyon() 320 | { 321 | int MutasyonaUgracakindex = Sayi.Next(1, 100); 322 | int MutasyonaUgracakgen = Sayi.Next(1, 20); 323 | int MutasyonYeniDeger = Sayi.Next(0, 4); 324 | if (YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] == 0 && !(MutasyonYeniDeger == 0)) 325 | { 326 | YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] = MutasyonYeniDeger; 327 | } 328 | else if (YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] == 1 && !(MutasyonYeniDeger == 1)) 329 | { 330 | YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] = MutasyonYeniDeger; 331 | } 332 | else if (YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] == 2 && !(MutasyonYeniDeger == 2)) 333 | { 334 | YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] = MutasyonYeniDeger; 335 | } 336 | else 337 | { 338 | YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] = MutasyonYeniDeger; 339 | } 340 | } 341 | 342 | public void YeniToplumUygunluk(int gilkNokta, int gSonNokta) 343 | { 344 | int ilk = gilkNokta; 345 | int Son = gSonNokta; 346 | //int durdur = 1; 347 | //while (durdur <= 4) 348 | //{ 349 | EnKucuk = 10000; 350 | EnKucukindex = 0; 351 | for (int i = 1; i < 101; i++) 352 | { 353 | ilk = gilkNokta; 354 | Son = gSonNokta; 355 | YeniToplumBireyUzunlugu[i] = 0; 356 | for (int j = 1; j <= 20; j++) 357 | { 358 | DonenDeger[j] = ToplumUygunlukNoktasi(ilk, YeniToplum[i, j], Son, j); 359 | YeniToplumPozisyonu[i, j] = DonenDeger[j]; 360 | YeniToplumBireyUzunlugu[i] = YeniToplumBireyUzunlugu[i] + ToplumUygunlukNoktaMesafesi(ilk, DonenDeger[j]); 361 | ilk = DonenDeger[j]; 362 | if (j == 20) 363 | { 364 | YeniToplumBireyUygunlugu[i] = ToplumUygunlukNoktaMesafesi(DonenDeger[j], gSonNokta); 365 | YeniToplumBireyUygunlugu[i] = YeniToplumBireyUygunlugu[i] + YeniToplumBireyUzunlugu[i] / 2; 366 | } 367 | } 368 | } 369 | for (int i = 1; i <= 100; i++) 370 | { 371 | if (YeniToplumBireyUygunlugu[i] < EnKucuk) 372 | { 373 | EnKucuk = YeniToplumBireyUygunlugu[i]; 374 | EnKucukindex = i; 375 | } 376 | } 377 | 378 | //if (durdur == 1) 379 | //{ 380 | for (int b = 1; b < 21; b++) 381 | { 382 | SonucRota[0, b] = YeniToplumPozisyonu[EnKucukindex, b]; 383 | } 384 | SonucRota[0, 21] = YeniToplumBireyUygunlugu[EnKucukindex]; 385 | //} 386 | 387 | 388 | //eniyiler[durdur] = EnKucukindex; 389 | //durdur++; 390 | //} 391 | 392 | } 393 | 394 | } 395 | } 396 | -------------------------------------------------------------------------------- /Program Kodu/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace YolBulma 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 32 | this.GrpBxKat1 = new System.Windows.Forms.GroupBox(); 33 | this.KrokiKampus = new System.Windows.Forms.PictureBox(); 34 | this.BtnBasla = new System.Windows.Forms.Button(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.label2 = new System.Windows.Forms.Label(); 37 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 38 | this.btnResimCiz = new System.Windows.Forms.Button(); 39 | this.comboBox4 = new System.Windows.Forms.ComboBox(); 40 | this.lblb = new System.Windows.Forms.Label(); 41 | this.lwb = new System.Windows.Forms.ListView(); 42 | this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 44 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 45 | this.btnGA = new System.Windows.Forms.Button(); 46 | this.lw2 = new System.Windows.Forms.ListView(); 47 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 48 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 49 | this.panel1 = new System.Windows.Forms.Panel(); 50 | this.label12 = new System.Windows.Forms.Label(); 51 | this.label9 = new System.Windows.Forms.Label(); 52 | this.label10 = new System.Windows.Forms.Label(); 53 | this.label8 = new System.Windows.Forms.Label(); 54 | this.label7 = new System.Windows.Forms.Label(); 55 | this.label5 = new System.Windows.Forms.Label(); 56 | this.txtBirey = new System.Windows.Forms.TextBox(); 57 | this.txtNesil = new System.Windows.Forms.TextBox(); 58 | this.label4 = new System.Windows.Forms.Label(); 59 | this.label3 = new System.Windows.Forms.Label(); 60 | this.panel2 = new System.Windows.Forms.Panel(); 61 | this.GrpBxKat1.SuspendLayout(); 62 | ((System.ComponentModel.ISupportInitialize)(this.KrokiKampus)).BeginInit(); 63 | this.groupBox1.SuspendLayout(); 64 | this.panel1.SuspendLayout(); 65 | this.panel2.SuspendLayout(); 66 | this.SuspendLayout(); 67 | // 68 | // GrpBxKat1 69 | // 70 | this.GrpBxKat1.Controls.Add(this.KrokiKampus); 71 | this.GrpBxKat1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 72 | this.GrpBxKat1.Location = new System.Drawing.Point(-2, 2); 73 | this.GrpBxKat1.Name = "GrpBxKat1"; 74 | this.GrpBxKat1.Size = new System.Drawing.Size(660, 472); 75 | this.GrpBxKat1.TabIndex = 3; 76 | this.GrpBxKat1.TabStop = false; 77 | this.GrpBxKat1.Text = "Kampüs Alanı"; 78 | // 79 | // KrokiKampus 80 | // 81 | this.KrokiKampus.BackColor = System.Drawing.Color.White; 82 | this.KrokiKampus.BackgroundImage = global::YolBulma.Properties.Resources.kroki1; 83 | this.KrokiKampus.Image = global::YolBulma.Properties.Resources.kroki1; 84 | this.KrokiKampus.Location = new System.Drawing.Point(6, 19); 85 | this.KrokiKampus.Name = "KrokiKampus"; 86 | this.KrokiKampus.Size = new System.Drawing.Size(650, 450); 87 | this.KrokiKampus.TabIndex = 0; 88 | this.KrokiKampus.TabStop = false; 89 | // 90 | // BtnBasla 91 | // 92 | this.BtnBasla.BackColor = System.Drawing.Color.PowderBlue; 93 | this.BtnBasla.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 94 | this.BtnBasla.Location = new System.Drawing.Point(6, 76); 95 | this.BtnBasla.Name = "BtnBasla"; 96 | this.BtnBasla.Size = new System.Drawing.Size(216, 41); 97 | this.BtnBasla.TabIndex = 6; 98 | this.BtnBasla.Text = "Yolu Bul"; 99 | this.BtnBasla.UseVisualStyleBackColor = false; 100 | this.BtnBasla.Click += new System.EventHandler(this.BtnBasla_Click); 101 | // 102 | // label1 103 | // 104 | this.label1.AutoSize = true; 105 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 106 | this.label1.Location = new System.Drawing.Point(6, 25); 107 | this.label1.Name = "label1"; 108 | this.label1.Size = new System.Drawing.Size(86, 13); 109 | this.label1.TabIndex = 7; 110 | this.label1.Text = "Bulunduğun Yer:"; 111 | // 112 | // label2 113 | // 114 | this.label2.AutoSize = true; 115 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 116 | this.label2.Location = new System.Drawing.Point(6, 52); 117 | this.label2.Name = "label2"; 118 | this.label2.Size = new System.Drawing.Size(73, 13); 119 | this.label2.TabIndex = 8; 120 | this.label2.Text = "Gidilecek Yer:"; 121 | // 122 | // groupBox1 123 | // 124 | this.groupBox1.BackColor = System.Drawing.Color.PowderBlue; 125 | this.groupBox1.Controls.Add(this.btnResimCiz); 126 | this.groupBox1.Controls.Add(this.comboBox4); 127 | this.groupBox1.Controls.Add(this.lblb); 128 | this.groupBox1.Controls.Add(this.lwb); 129 | this.groupBox1.Controls.Add(this.BtnBasla); 130 | this.groupBox1.Controls.Add(this.comboBox2); 131 | this.groupBox1.Controls.Add(this.label1); 132 | this.groupBox1.Controls.Add(this.label2); 133 | this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 134 | this.groupBox1.Location = new System.Drawing.Point(664, 2); 135 | this.groupBox1.Name = "groupBox1"; 136 | this.groupBox1.Size = new System.Drawing.Size(231, 417); 137 | this.groupBox1.TabIndex = 9; 138 | this.groupBox1.TabStop = false; 139 | this.groupBox1.Text = "Kampüste Yer Seç"; 140 | // 141 | // btnResimCiz 142 | // 143 | this.btnResimCiz.BackColor = System.Drawing.Color.PowderBlue; 144 | this.btnResimCiz.Location = new System.Drawing.Point(6, 316); 145 | this.btnResimCiz.Name = "btnResimCiz"; 146 | this.btnResimCiz.Size = new System.Drawing.Size(216, 37); 147 | this.btnResimCiz.TabIndex = 15; 148 | this.btnResimCiz.Text = "Seçili Mesafeyi Çiz"; 149 | this.btnResimCiz.UseVisualStyleBackColor = false; 150 | this.btnResimCiz.Visible = false; 151 | this.btnResimCiz.Click += new System.EventHandler(this.btnResimCiz_Click); 152 | // 153 | // comboBox4 154 | // 155 | this.comboBox4.FormattingEnabled = true; 156 | this.comboBox4.Items.AddRange(new object[] { 157 | "Nokta Seç:", 158 | "1", 159 | "2", 160 | "3", 161 | "4", 162 | "5", 163 | "6", 164 | "7", 165 | "8", 166 | "9", 167 | "10", 168 | "11", 169 | "12", 170 | "13", 171 | "14", 172 | "15", 173 | "16", 174 | "17", 175 | "18", 176 | "19", 177 | "20", 178 | "21", 179 | "22", 180 | "23", 181 | "24"}); 182 | this.comboBox4.Location = new System.Drawing.Point(98, 49); 183 | this.comboBox4.Name = "comboBox4"; 184 | this.comboBox4.Size = new System.Drawing.Size(95, 21); 185 | this.comboBox4.TabIndex = 13; 186 | // 187 | // lblb 188 | // 189 | this.lblb.AutoSize = true; 190 | this.lblb.BackColor = System.Drawing.Color.PowderBlue; 191 | this.lblb.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 192 | this.lblb.Location = new System.Drawing.Point(3, 132); 193 | this.lblb.Name = "lblb"; 194 | this.lblb.Size = new System.Drawing.Size(161, 13); 195 | this.lblb.TabIndex = 13; 196 | this.lblb.Text = "Bulunan Tüm Güzergahlar :"; 197 | this.lblb.Visible = false; 198 | // 199 | // lwb 200 | // 201 | this.lwb.BackColor = System.Drawing.Color.PowderBlue; 202 | this.lwb.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 203 | this.columnHeader1, 204 | this.columnHeader2}); 205 | this.lwb.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 206 | this.lwb.GridLines = true; 207 | this.lwb.Location = new System.Drawing.Point(9, 148); 208 | this.lwb.Name = "lwb"; 209 | this.lwb.Size = new System.Drawing.Size(213, 162); 210 | this.lwb.TabIndex = 14; 211 | this.lwb.UseCompatibleStateImageBehavior = false; 212 | this.lwb.View = System.Windows.Forms.View.Details; 213 | this.lwb.Visible = false; 214 | // 215 | // columnHeader1 216 | // 217 | this.columnHeader1.Text = "Mesafe"; 218 | this.columnHeader1.Width = 56; 219 | // 220 | // columnHeader2 221 | // 222 | this.columnHeader2.Text = "İzlenecek Rota"; 223 | this.columnHeader2.Width = 154; 224 | // 225 | // comboBox2 226 | // 227 | this.comboBox2.FormattingEnabled = true; 228 | this.comboBox2.Items.AddRange(new object[] { 229 | "Nokta Seç:", 230 | "1", 231 | "2", 232 | "3", 233 | "4", 234 | "5", 235 | "6", 236 | "7", 237 | "8", 238 | "9", 239 | "10", 240 | "11", 241 | "12", 242 | "13", 243 | "14", 244 | "15", 245 | "16", 246 | "17", 247 | "18", 248 | "19", 249 | "20", 250 | "21", 251 | "22", 252 | "23", 253 | "24"}); 254 | this.comboBox2.Location = new System.Drawing.Point(98, 22); 255 | this.comboBox2.Name = "comboBox2"; 256 | this.comboBox2.Size = new System.Drawing.Size(95, 21); 257 | this.comboBox2.TabIndex = 9; 258 | // 259 | // btnGA 260 | // 261 | this.btnGA.BackColor = System.Drawing.Color.DodgerBlue; 262 | this.btnGA.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 263 | this.btnGA.Location = new System.Drawing.Point(664, 425); 264 | this.btnGA.Name = "btnGA"; 265 | this.btnGA.Size = new System.Drawing.Size(231, 46); 266 | this.btnGA.TabIndex = 15; 267 | this.btnGA.Text = "Program Hakkında Bilgi ve Parametreler"; 268 | this.btnGA.UseVisualStyleBackColor = false; 269 | this.btnGA.Click += new System.EventHandler(this.button1_Click); 270 | // 271 | // lw2 272 | // 273 | this.lw2.BackColor = System.Drawing.Color.PaleGreen; 274 | this.lw2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 275 | this.columnHeader3, 276 | this.columnHeader4}); 277 | this.lw2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 278 | this.lw2.GridLines = true; 279 | this.lw2.Location = new System.Drawing.Point(3, 3); 280 | this.lw2.Name = "lw2"; 281 | this.lw2.Size = new System.Drawing.Size(184, 455); 282 | this.lw2.TabIndex = 15; 283 | this.lw2.UseCompatibleStateImageBehavior = false; 284 | this.lw2.View = System.Windows.Forms.View.Details; 285 | // 286 | // columnHeader3 287 | // 288 | this.columnHeader3.Text = "Yer"; 289 | this.columnHeader3.Width = 34; 290 | // 291 | // columnHeader4 292 | // 293 | this.columnHeader4.Text = "Bilgi"; 294 | this.columnHeader4.Width = 147; 295 | // 296 | // panel1 297 | // 298 | this.panel1.BackColor = System.Drawing.Color.DodgerBlue; 299 | this.panel1.Controls.Add(this.label12); 300 | this.panel1.Controls.Add(this.label9); 301 | this.panel1.Controls.Add(this.label10); 302 | this.panel1.Controls.Add(this.label8); 303 | this.panel1.Controls.Add(this.label7); 304 | this.panel1.Controls.Add(this.label5); 305 | this.panel1.Controls.Add(this.txtBirey); 306 | this.panel1.Controls.Add(this.txtNesil); 307 | this.panel1.Controls.Add(this.label4); 308 | this.panel1.Controls.Add(this.label3); 309 | this.panel1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 310 | this.panel1.Location = new System.Drawing.Point(4, 486); 311 | this.panel1.Name = "panel1"; 312 | this.panel1.Size = new System.Drawing.Size(891, 139); 313 | this.panel1.TabIndex = 16; 314 | // 315 | // label12 316 | // 317 | this.label12.AutoSize = true; 318 | this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 319 | this.label12.Location = new System.Drawing.Point(3, 16); 320 | this.label12.Name = "label12"; 321 | this.label12.Size = new System.Drawing.Size(510, 117); 322 | this.label12.TabIndex = 14; 323 | this.label12.Text = resources.GetString("label12.Text"); 324 | // 325 | // label9 326 | // 327 | this.label9.AutoSize = true; 328 | this.label9.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 329 | this.label9.Location = new System.Drawing.Point(3, 0); 330 | this.label9.Name = "label9"; 331 | this.label9.Size = new System.Drawing.Size(164, 13); 332 | this.label9.TabIndex = 13; 333 | this.label9.Text = "Program Hakkında Bilgi:"; 334 | // 335 | // label10 336 | // 337 | this.label10.AutoSize = true; 338 | this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 339 | this.label10.Location = new System.Drawing.Point(3, 16); 340 | this.label10.Name = "label10"; 341 | this.label10.Size = new System.Drawing.Size(0, 13); 342 | this.label10.TabIndex = 11; 343 | // 344 | // label8 345 | // 346 | this.label8.AutoSize = true; 347 | this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 348 | this.label8.Location = new System.Drawing.Point(633, 29); 349 | this.label8.Name = "label8"; 350 | this.label8.Size = new System.Drawing.Size(243, 26); 351 | this.label8.TabIndex = 9; 352 | this.label8.Text = "Populasyon: Kromozomlardan (bireylerden) oluşan \r\n kümedir. "; 353 | // 354 | // label7 355 | // 356 | this.label7.AutoSize = true; 357 | this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 358 | this.label7.Location = new System.Drawing.Point(633, 16); 359 | this.label7.Name = "label7"; 360 | this.label7.Size = new System.Drawing.Size(259, 13); 361 | this.label7.TabIndex = 8; 362 | this.label7.Text = "Kromozom (Birey): Alternatif aday çözümleri gösterirler."; 363 | // 364 | // label5 365 | // 366 | this.label5.AutoSize = true; 367 | this.label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 368 | this.label5.Location = new System.Drawing.Point(633, 3); 369 | this.label5.Name = "label5"; 370 | this.label5.Size = new System.Drawing.Size(195, 13); 371 | this.label5.TabIndex = 7; 372 | this.label5.Text = "Parametreler Hakkında Bilgi:"; 373 | // 374 | // txtBirey 375 | // 376 | this.txtBirey.Location = new System.Drawing.Point(757, 81); 377 | this.txtBirey.Name = "txtBirey"; 378 | this.txtBirey.Size = new System.Drawing.Size(71, 21); 379 | this.txtBirey.TabIndex = 5; 380 | this.txtBirey.Text = "30"; 381 | // 382 | // txtNesil 383 | // 384 | this.txtNesil.Location = new System.Drawing.Point(757, 57); 385 | this.txtNesil.Name = "txtNesil"; 386 | this.txtNesil.Size = new System.Drawing.Size(71, 21); 387 | this.txtNesil.TabIndex = 4; 388 | this.txtNesil.Text = "50"; 389 | // 390 | // label4 391 | // 392 | this.label4.AutoSize = true; 393 | this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 394 | this.label4.Location = new System.Drawing.Point(633, 84); 395 | this.label4.Name = "label4"; 396 | this.label4.Size = new System.Drawing.Size(118, 13); 397 | this.label4.TabIndex = 1; 398 | this.label4.Text = "Populasyon Büyüklüğü:"; 399 | // 400 | // label3 401 | // 402 | this.label3.AutoSize = true; 403 | this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 404 | this.label3.Location = new System.Drawing.Point(633, 60); 405 | this.label3.Name = "label3"; 406 | this.label3.Size = new System.Drawing.Size(63, 13); 407 | this.label3.TabIndex = 0; 408 | this.label3.Text = "Nesil Sayısı:"; 409 | // 410 | // panel2 411 | // 412 | this.panel2.BackColor = System.Drawing.Color.PaleGreen; 413 | this.panel2.Controls.Add(this.lw2); 414 | this.panel2.Location = new System.Drawing.Point(910, 11); 415 | this.panel2.Name = "panel2"; 416 | this.panel2.Size = new System.Drawing.Size(194, 464); 417 | this.panel2.TabIndex = 17; 418 | // 419 | // Form1 420 | // 421 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 422 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 423 | this.ClientSize = new System.Drawing.Size(903, 630); 424 | this.Controls.Add(this.panel2); 425 | this.Controls.Add(this.panel1); 426 | this.Controls.Add(this.btnGA); 427 | this.Controls.Add(this.groupBox1); 428 | this.Controls.Add(this.GrpBxKat1); 429 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 430 | this.MaximizeBox = false; 431 | this.Name = "Form1"; 432 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; 433 | this.Text = "Genetik Algoritma ile Noktadan Noktaya Yol ve Rota Planlama ( Yapay Zeka Projesi " + 434 | "| Bülent SİYAH | 2011)"; 435 | this.Load += new System.EventHandler(this.Form1_Load); 436 | this.GrpBxKat1.ResumeLayout(false); 437 | ((System.ComponentModel.ISupportInitialize)(this.KrokiKampus)).EndInit(); 438 | this.groupBox1.ResumeLayout(false); 439 | this.groupBox1.PerformLayout(); 440 | this.panel1.ResumeLayout(false); 441 | this.panel1.PerformLayout(); 442 | this.panel2.ResumeLayout(false); 443 | this.ResumeLayout(false); 444 | 445 | } 446 | 447 | #endregion 448 | 449 | private System.Windows.Forms.PictureBox KrokiKampus; 450 | private System.Windows.Forms.GroupBox GrpBxKat1; 451 | private System.Windows.Forms.Button BtnBasla; 452 | private System.Windows.Forms.Label label1; 453 | private System.Windows.Forms.Label label2; 454 | private System.Windows.Forms.GroupBox groupBox1; 455 | private System.Windows.Forms.ComboBox comboBox2; 456 | private System.Windows.Forms.ComboBox comboBox4; 457 | private System.Windows.Forms.Label lblb; 458 | private System.Windows.Forms.ListView lwb; 459 | private System.Windows.Forms.ColumnHeader columnHeader1; 460 | private System.Windows.Forms.ColumnHeader columnHeader2; 461 | private System.Windows.Forms.Button btnGA; 462 | private System.Windows.Forms.ListView lw2; 463 | private System.Windows.Forms.ColumnHeader columnHeader3; 464 | private System.Windows.Forms.ColumnHeader columnHeader4; 465 | private System.Windows.Forms.Panel panel1; 466 | private System.Windows.Forms.Label label4; 467 | private System.Windows.Forms.Label label3; 468 | private System.Windows.Forms.Panel panel2; 469 | private System.Windows.Forms.TextBox txtBirey; 470 | private System.Windows.Forms.TextBox txtNesil; 471 | private System.Windows.Forms.Label label10; 472 | private System.Windows.Forms.Label label8; 473 | private System.Windows.Forms.Label label7; 474 | private System.Windows.Forms.Label label5; 475 | private System.Windows.Forms.Label label9; 476 | private System.Windows.Forms.Label label12; 477 | private System.Windows.Forms.Button btnResimCiz; 478 | 479 | } 480 | } 481 | 482 | -------------------------------------------------------------------------------- /Program Kodu/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace YolBulma 11 | { 12 | public partial class Form1 : Form 13 | { 14 | static int NesilSayisi; 15 | int NesilSayisiTespiti; 16 | int BireySayisi; 17 | int ElitSayisi; 18 | int MutasyonSayisi; 19 | int MutasyonOranı; 20 | int GenSayisi; 21 | int ilkNokta, SonNokta; 22 | int EnKucuk; 23 | int EnKucukindex; 24 | int BulunanFarkliCozumSayisi; 25 | Random Sayi = new Random(); 26 | //int CizilecekResim, CizilecekResim1, CizilecekResim2; 27 | Bitmap bitmap; 28 | int eskix, eskiy; 29 | int[,] NoktaKoordinatlari = new int[25, 2]; 30 | int[,] NoktalariCiz; 31 | int[,] ilkToplum; 32 | int[,] ilkToplumPozisyonu; 33 | int[] ilkToplumBireyUygunlugu; 34 | int[,] YeniToplum; 35 | int[,] YeniToplumPozisyonu; 36 | int[] YeniToplumBireyUygunlugu; 37 | public Form1() 38 | { 39 | InitializeComponent(); 40 | } 41 | private void Form1_Load(object sender, EventArgs e) 42 | { 43 | comboBox2.SelectedIndex = 0; 44 | comboBox4.SelectedIndex = 0; 45 | } 46 | 47 | //private void btnBilgi_Click(object sender, EventArgs e) 48 | //{ 49 | // if (btnBilgi.Text == "Kampüsteki Yerler Hakkında Bilgi ->>") 50 | // { 51 | // btnBilgi.Text = " Yer Bilgilerini Gizle <<-"; 52 | // this.Width = 1113; 53 | // } 54 | // else 55 | // { 56 | // btnBilgi.Text = "Kampüsteki Yerler Hakkında Bilgi ->>"; 57 | // this.Width = 909; 58 | // } 59 | //} 60 | private void button1_Click(object sender, EventArgs e) 61 | { 62 | if (btnGA.Text == "Program Hakkında Bilgi ve Parametreler") 63 | { 64 | btnGA.Text = " Bilgi ve Parametreleri Gizle "; 65 | 66 | this.Height = 661; 67 | } 68 | else 69 | { 70 | btnGA.Text = "Program Hakkında Bilgi ve Parametreler"; 71 | 72 | this.Height = 514; 73 | } 74 | } 75 | private void BtnBasla_Click(object sender, EventArgs e) 76 | { 77 | KrokiKampus.Image = new Bitmap(KrokiKampus.Width, KrokiKampus.Height); 78 | if (comboBox2.SelectedIndex == 0 || comboBox4.SelectedIndex == 0) 79 | { 80 | MessageBox.Show("Bulunduğunuz veya Gitmek istenilen Yer Seçilmedi."); 81 | } 82 | else if (comboBox4.SelectedIndex == comboBox2.SelectedIndex && comboBox2.SelectedIndex != 0) 83 | { 84 | MessageBox.Show("Bulunduğunuz ve Gitmek istenilen Yer Aynı Olamaz."); 85 | } 86 | else 87 | { 88 | 89 | try 90 | { 91 | NesilSayisi = Convert.ToInt32(txtNesil.Text); 92 | BireySayisi = Convert.ToInt32(txtBirey.Text); 93 | } 94 | catch 95 | { 96 | MessageBox.Show("Girilen Değerler Geçerli Değil.Rakam Giriniz."); 97 | return; 98 | } 99 | 100 | if (NesilSayisi <= 1 || BireySayisi <= 1) 101 | { 102 | MessageBox.Show("Girilen Değerler Geçerli Değil.Değer '1' dan Büyük Olmalıdır."); 103 | return; 104 | } 105 | //BAZI DEGERLER BURADA SABITLENIP YONETILEBILIR.. 106 | MutasyonSayisi = 1; //mutasyon oranını buradan duzenlenebılır.. 107 | MutasyonOranı = 1;//burada mutasyona ugrayacak gen sayısı belırlenebılır.. 108 | ElitSayisi = (BireySayisi / 10);//en iyiler secılırken gerıye kalanlar ÇAPRAZLAMA ORANINI OLDUGU ICIN BU PARAMETREDE ONEMLI 109 | GenSayisi = 20; //gen sayısnı sabıtlendı.. 110 | NesilSayisiTespiti = NesilSayisi;//ılk nesıl olup olmadıgını anlamızı saglayacak degerdır. 111 | ilkNokta = comboBox2.SelectedIndex; 112 | SonNokta = comboBox4.SelectedIndex; 113 | EnKucuk = 100000; 114 | EnKucukindex = 0; 115 | BulunanFarkliCozumSayisi = 1; 116 | eskix = -1; 117 | eskiy = -1; 118 | ilkToplum = new int[BireySayisi + 1, GenSayisi + 1]; 119 | ilkToplumPozisyonu = new int[BireySayisi + 1, GenSayisi + 1]; 120 | ilkToplumBireyUygunlugu = new int[BireySayisi + 1]; 121 | YeniToplum = new int[BireySayisi + 1, GenSayisi + 1]; 122 | YeniToplumPozisyonu = new int[BireySayisi + 1, GenSayisi + 1]; 123 | YeniToplumBireyUygunlugu = new int[BireySayisi + 1]; 124 | NoktalariCiz = new int[100, GenSayisi + 1]; 125 | lblb.Visible = true; 126 | lwb.Visible = true; 127 | btnResimCiz.Visible = true; 128 | AyniKatRotaBul(); 129 | 130 | } 131 | 132 | } 133 | 134 | public void AyniKatRotaBul() 135 | { 136 | lwb.Items.Clear(); 137 | String rotaEski = ""; 138 | BulunanFarkliCozumSayisi = 1; 139 | while (NesilSayisi != 0) 140 | { 141 | String rotayaz = ilkNokta.ToString(); 142 | RotaGonder(); 143 | YeniToplumPozisyonu[1, 0] = ilkNokta; 144 | for (int b = 1; b <= GenSayisi; b++) 145 | { 146 | 147 | if (YeniToplumPozisyonu[1, b] != YeniToplumPozisyonu[1, b - 1]) 148 | { 149 | rotayaz = rotayaz + "-" + YeniToplumPozisyonu[1, b].ToString(); 150 | } 151 | } 152 | if (!rotaEski.Equals(rotayaz)) 153 | { 154 | for (int a = 1; a <= GenSayisi; a++) 155 | { 156 | NoktalariCiz[BulunanFarkliCozumSayisi, 0] = ilkNokta; 157 | NoktalariCiz[BulunanFarkliCozumSayisi, a] = YeniToplumPozisyonu[1, a]; 158 | } 159 | lwb.Items.Add(BulunanFarkliCozumSayisi + "-) " + YeniToplumBireyUygunlugu[1]); 160 | lwb.Items[BulunanFarkliCozumSayisi - 1].SubItems.Add(rotayaz); 161 | BulunanFarkliCozumSayisi++; 162 | } 163 | rotaEski = rotayaz; 164 | NesilSayisi--; 165 | } 166 | 167 | CizilecekRotayiBelirle(BulunanFarkliCozumSayisi-1);// en ıyı sonucu yazdırması ıcın.. 168 | 169 | } 170 | public void CizilecekRotayiBelirle(int SecilenRota) 171 | { 172 | KrokiKampus.Image = new Bitmap(KrokiKampus.Width, KrokiKampus.Height); 173 | eskix = -1; 174 | eskiy = -1; 175 | for (int b = 0; b <= GenSayisi; b++) 176 | { 177 | ResimCizdir(NoktaKoordinatlari[NoktalariCiz[SecilenRota, b], 0], NoktaKoordinatlari[NoktalariCiz[SecilenRota, b], 1]);//secılen rotanın ılk noktasının x ve y sını cızdırmek ıcın baska fonksıyoa gonderıyoruz.. 178 | } 179 | 180 | } 181 | private void btnResimCiz_Click(object sender, EventArgs e) 182 | { 183 | try 184 | { 185 | int Seciliindex; 186 | ListViewItem Secilen = lwb.SelectedItems[0]; 187 | Seciliindex = Secilen.Index; 188 | CizilecekRotayiBelirle(Seciliindex + 1); 189 | // MessageBox.Show("secili index: " + Seciliindex); 190 | 191 | } 192 | catch 193 | { 194 | MessageBox.Show("Mesafe Seçili Değil Listedeki Mesafelerden Birini Seçip Tıklayın"); 195 | } 196 | 197 | } 198 | public void RotaGonder() 199 | { 200 | NoktaKoordinatlariYerlestir(); 201 | ToplumOlustur(); 202 | ToplumUygunluk(); 203 | ToplumSeckincilik(); 204 | ToplumCaprazlama(); 205 | ToplumMutasyon(); 206 | YeniToplumUygunluk(); 207 | 208 | } 209 | public void ToplumOlustur() 210 | { 211 | if (NesilSayisi == NesilSayisiTespiti)//ilk nesıl oldugunu anlarım 212 | { 213 | for (int i = 1; i <= BireySayisi; i++) 214 | { 215 | for (int j = 1; j <= GenSayisi; j++) 216 | { 217 | 218 | ilkToplum[i, j] = Sayi.Next(0, 4); 219 | } 220 | } 221 | } 222 | } 223 | public void ToplumUygunluk() 224 | { 225 | int Degisenilk, SonPozisyon; 226 | for (int i = 1; i <= BireySayisi; i++) 227 | { 228 | ilkToplumBireyUygunlugu[i] = 0; 229 | Degisenilk = ilkNokta; 230 | for (int j = 1; j <= GenSayisi; j++) 231 | { 232 | if (Degisenilk == SonNokta) 233 | { 234 | ilkToplumPozisyonu[i, j] = SonNokta; 235 | } 236 | else 237 | { 238 | ilkToplumPozisyonu[i, j] = BireyinBirSonrakiNoktasi(Degisenilk, ilkToplum[i, j]); 239 | } 240 | //for (int jk = 1; jk < j; jk++) 241 | //{ 242 | // if ((ilkToplumPozisyonu[i, j] == ilkToplumPozisyonu[i, jk])) 243 | // { 244 | // ilkToplumPozisyonu[i, j] = Degisenilk; 245 | // } 246 | //} 247 | 248 | ilkToplumBireyUygunlugu[i] = ilkToplumBireyUygunlugu[i] + BireyinNoktadanNoktayaMesafesi(Degisenilk, ilkToplumPozisyonu[i, j]); 249 | Degisenilk = ilkToplumPozisyonu[i, j]; 250 | if (j == GenSayisi) 251 | { 252 | SonPozisyon = BireyinNoktadanNoktayaMesafesi(ilkToplumPozisyonu[i, j], SonNokta); 253 | ilkToplumBireyUygunlugu[i] = 5 * SonPozisyon + ilkToplumBireyUygunlugu[i]; 254 | } 255 | } 256 | } 257 | } 258 | public int BireyinBirSonrakiNoktasi(int gilkNokta, int gYon) 259 | { 260 | int sonuc; 261 | 262 | if (gYon == 0 && !(gilkNokta == 1 || gilkNokta == 2 || gilkNokta == 3 || gilkNokta == 4)) 263 | { 264 | sonuc = gilkNokta - 4; 265 | } 266 | else if (gYon == 1 && !(gilkNokta == 1 || gilkNokta == 5 || gilkNokta == 9 || gilkNokta == 13 || gilkNokta == 17 || gilkNokta == 21)) 267 | { 268 | sonuc = gilkNokta - 1; 269 | } 270 | else if (gYon == 2 && !(gilkNokta == 21 || gilkNokta == 22 || gilkNokta == 23 || gilkNokta == 24)) 271 | { 272 | sonuc = gilkNokta + 4; 273 | } 274 | else if (gYon == 3 && !(gilkNokta == 4 || gilkNokta == 8 || gilkNokta == 12 || gilkNokta == 16 || gilkNokta == 20 || gilkNokta == 24)) 275 | { 276 | sonuc = gilkNokta + 1; 277 | } 278 | else 279 | { 280 | sonuc = gilkNokta; 281 | } 282 | 283 | return sonuc; 284 | 285 | } 286 | public int BireyinNoktadanNoktayaMesafesi(int gilkNokta, int gikinciNokta) 287 | { 288 | double islem; 289 | if (gilkNokta != gikinciNokta) 290 | { 291 | islem = Math.Pow(NoktaKoordinatlari[gilkNokta, 0] - NoktaKoordinatlari[gikinciNokta, 0], 2) + Math.Pow(NoktaKoordinatlari[gilkNokta, 1] - NoktaKoordinatlari[gikinciNokta, 1], 2); 292 | islem = Convert.ToInt32(Math.Sqrt(islem)); 293 | } 294 | else 295 | { 296 | islem = 0; 297 | } 298 | return (int)islem; 299 | } 300 | 301 | public void ToplumSeckincilik() 302 | { 303 | for (int a = 1; a <= BireySayisi; a++) 304 | { 305 | EnKucuk = 100000; 306 | EnKucukindex = 0; 307 | int gecici = 0, gecici2 = 0; 308 | for (int b = a; b <= BireySayisi; b++) 309 | { 310 | if (ilkToplumBireyUygunlugu[b] < (EnKucuk)) 311 | { 312 | EnKucuk = ilkToplumBireyUygunlugu[b]; 313 | EnKucukindex = b; 314 | } 315 | } 316 | gecici = ilkToplumBireyUygunlugu[a]; 317 | ilkToplumBireyUygunlugu[a] = ilkToplumBireyUygunlugu[EnKucukindex]; 318 | ilkToplumBireyUygunlugu[EnKucukindex] = gecici; 319 | for (int c = 1; c <= GenSayisi; c++) 320 | { 321 | gecici2 = ilkToplum[a, c]; 322 | ilkToplum[a, c] = ilkToplum[EnKucukindex, c]; 323 | ilkToplum[EnKucukindex, c] = gecici2; 324 | } 325 | } 326 | for (int index = 1; index <= ElitSayisi; index++) 327 | { 328 | for (int bb = 1; bb <= GenSayisi; bb++) 329 | { 330 | YeniToplum[index, bb] = ilkToplum[index, bb]; 331 | } 332 | } 333 | 334 | } 335 | public void ToplumCaprazlama() 336 | { 337 | 338 | //int geciciDeger = 0; 339 | //for (int s = 3; s < BireySayisi; s = s + 2) 340 | //{ 341 | // for (int b = 11; b < 21; b++) 342 | // { 343 | // geciciDeger = YeniToplum[s, b]; 344 | // YeniToplum[s, b] = YeniToplum[s + 1, b]; 345 | // YeniToplum[s + 1, b] = geciciDeger; 346 | // } 347 | 348 | //} 349 | int WhileDongusu = ElitSayisi + 1; 350 | int rastgeleBirey, rastgeleBirey2, rastgeleBirey3, rastgeleBirey4, lopus; 351 | while (WhileDongusu <= BireySayisi) 352 | { 353 | if (WhileDongusu == BireySayisi) 354 | { 355 | WhileDongusu--; 356 | } 357 | rastgeleBirey = Sayi.Next(1, BireySayisi); 358 | rastgeleBirey2 = Sayi.Next(1, BireySayisi); 359 | rastgeleBirey3 = Sayi.Next(1, BireySayisi); 360 | rastgeleBirey4 = Sayi.Next(1, BireySayisi); 361 | lopus = Sayi.Next(2, GenSayisi - 1); 362 | if (rastgeleBirey < rastgeleBirey2) 363 | { 364 | 365 | if (rastgeleBirey3 < rastgeleBirey4) 366 | { 367 | for (int b = 1; b < lopus; b++) 368 | { 369 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey, b]; 370 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey3, b]; 371 | } 372 | for (int b = (lopus); b <= GenSayisi; b++) 373 | { 374 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey3, b]; 375 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey, b]; 376 | } 377 | 378 | } 379 | else 380 | { 381 | for (int b = 1; b < lopus; b++) 382 | { 383 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey, b]; 384 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey4, b]; 385 | } 386 | for (int b = (lopus); b <= GenSayisi; b++) 387 | { 388 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey4, b]; 389 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey, b]; 390 | } 391 | 392 | } 393 | 394 | } 395 | else 396 | { 397 | if (rastgeleBirey3 < rastgeleBirey4) 398 | { 399 | for (int b = 1; b < lopus; b++) 400 | { 401 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey2, b]; 402 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey3, b]; 403 | } 404 | for (int b = (lopus); b <= GenSayisi; b++) 405 | { 406 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey3, b]; 407 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey2, b]; 408 | } 409 | } 410 | else 411 | { 412 | for (int b = 1; b < lopus; b++) 413 | { 414 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey2, b]; 415 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey4, b]; 416 | } 417 | for (int b = (lopus); b <= GenSayisi; b++) 418 | { 419 | YeniToplum[WhileDongusu, b] = ilkToplum[rastgeleBirey4, b]; 420 | YeniToplum[WhileDongusu + 1, b] = ilkToplum[rastgeleBirey2, b]; 421 | } 422 | } 423 | } 424 | 425 | WhileDongusu = WhileDongusu + 2; 426 | } 427 | 428 | } 429 | 430 | public void ToplumMutasyon() 431 | { 432 | while (MutasyonSayisi != 0) 433 | { 434 | int MutasyonaUgracakindex; 435 | if (BireySayisi < 3) 436 | { 437 | MutasyonaUgracakindex = 1; 438 | } 439 | else 440 | { 441 | MutasyonaUgracakindex = Sayi.Next(ElitSayisi + 1, BireySayisi); 442 | } 443 | while (MutasyonOranı != 0) 444 | { 445 | int MutasyonaUgracakgen = Sayi.Next(1, GenSayisi); 446 | int MutasyonYeniDeger = Sayi.Next(0, 4); 447 | while (YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] == MutasyonYeniDeger) 448 | { 449 | MutasyonYeniDeger = Sayi.Next(0, 4); 450 | } 451 | YeniToplum[MutasyonaUgracakindex, MutasyonaUgracakgen] = MutasyonYeniDeger; 452 | MutasyonOranı--; 453 | } 454 | MutasyonSayisi--; 455 | } 456 | } 457 | 458 | public void YeniToplumUygunluk() 459 | { 460 | int Degisenilk, SonPozisyon; 461 | for (int i = 1; i <= BireySayisi; i++) 462 | { 463 | YeniToplumBireyUygunlugu[i] = 0; 464 | Degisenilk = ilkNokta; 465 | for (int j = 1; j <= GenSayisi; j++) 466 | { 467 | if (Degisenilk == SonNokta) 468 | { 469 | YeniToplumPozisyonu[i, j] = SonNokta; 470 | } 471 | else 472 | { 473 | YeniToplumPozisyonu[i, j] = BireyinBirSonrakiNoktasi(Degisenilk, YeniToplum[i, j]); 474 | } 475 | //for (int jk = 1; jk < j; jk++) 476 | //{ 477 | // if (YeniToplumPozisyonu[i, j] == YeniToplumPozisyonu[i, jk]) 478 | // { 479 | // YeniToplumPozisyonu[i, j] = Degisenilk; 480 | // } 481 | //} 482 | YeniToplumBireyUygunlugu[i] = YeniToplumBireyUygunlugu[i] + BireyinNoktadanNoktayaMesafesi(Degisenilk, YeniToplumPozisyonu[i, j]); 483 | Degisenilk = YeniToplumPozisyonu[i, j]; 484 | if (j == GenSayisi) 485 | { 486 | SonPozisyon = BireyinNoktadanNoktayaMesafesi(YeniToplumPozisyonu[i, j], SonNokta); 487 | YeniToplumBireyUygunlugu[i] = 5 * SonPozisyon + YeniToplumBireyUygunlugu[i]; 488 | } 489 | } 490 | } 491 | for (int a = 1; a <= BireySayisi; a++) 492 | { 493 | EnKucuk = 100000; 494 | EnKucukindex = 0; 495 | int gecici = 0, gecici2 = 0, gecici3 = 0; 496 | for (int b = a; b <= BireySayisi; b++) 497 | { 498 | if (YeniToplumBireyUygunlugu[b] < (EnKucuk)) 499 | { 500 | EnKucuk = YeniToplumBireyUygunlugu[b]; 501 | EnKucukindex = b; 502 | } 503 | } 504 | gecici = YeniToplumBireyUygunlugu[a]; 505 | YeniToplumBireyUygunlugu[a] = YeniToplumBireyUygunlugu[EnKucukindex]; 506 | YeniToplumBireyUygunlugu[EnKucukindex] = gecici; 507 | 508 | 509 | for (int c = 1; c <= GenSayisi; c++) 510 | { 511 | gecici2 = YeniToplum[a, c]; 512 | YeniToplum[a, c] = YeniToplum[EnKucukindex, c]; 513 | YeniToplum[EnKucukindex, c] = gecici2; 514 | gecici3 = YeniToplumPozisyonu[a, c]; 515 | YeniToplumPozisyonu[a, c] = YeniToplumPozisyonu[EnKucukindex, c]; 516 | YeniToplumPozisyonu[EnKucukindex, c] = gecici3; 517 | } 518 | } 519 | 520 | 521 | for (int i = 1; i <= BireySayisi; i++) 522 | { 523 | 524 | for (int h = 1; h <= GenSayisi; h++) 525 | { 526 | ilkToplum[i, h] = YeniToplum[i, h]; 527 | 528 | } 529 | 530 | } 531 | 532 | } 533 | public void ResimCizdir(int x, int y) 534 | { 535 | bitmap = (Bitmap)KrokiKampus.Image; 536 | Graphics g = Graphics.FromImage(bitmap); 537 | g.FillEllipse(new SolidBrush(Color.DarkRed), x - 5, y - 5, 10, 10); 538 | //g.DrawString(">>", new Font("Arial", 7), new SolidBrush(Color.White), x - 10, y - 10); 539 | if (eskix != -1) 540 | { 541 | g.DrawLine(new Pen(Color.Red), (float)eskix, (float)eskiy, (float)x, (float)y); 542 | } 543 | eskix = x; 544 | eskiy = y; 545 | KrokiKampus.Image = bitmap; 546 | } 547 | public void NoktaKoordinatlariYerlestir() 548 | { 549 | NoktaKoordinatlari[1, 0] = 16; 550 | NoktaKoordinatlari[1, 1] = 56; 551 | NoktaKoordinatlari[2, 0] = 58; 552 | NoktaKoordinatlari[2, 1] = 156; 553 | NoktaKoordinatlari[3, 0] = 21; 554 | NoktaKoordinatlari[3, 1] = 232; 555 | NoktaKoordinatlari[4, 0] = 44; 556 | NoktaKoordinatlari[4, 1] = 356; 557 | NoktaKoordinatlari[5, 0] = 137; 558 | NoktaKoordinatlari[5, 1] = 13; 559 | NoktaKoordinatlari[6, 0] = 108; 560 | NoktaKoordinatlari[6, 1] = 100; 561 | NoktaKoordinatlari[7, 0] = 120; 562 | NoktaKoordinatlari[7, 1] = 238; 563 | NoktaKoordinatlari[8, 0] = 127; 564 | NoktaKoordinatlari[8, 1] = 400; 565 | NoktaKoordinatlari[9, 0] = 222; 566 | NoktaKoordinatlari[9, 1] = 76; 567 | NoktaKoordinatlari[10, 0] = 241; 568 | NoktaKoordinatlari[10, 1] = 171; 569 | NoktaKoordinatlari[11, 0] = 215; 570 | NoktaKoordinatlari[11, 1] = 294; 571 | NoktaKoordinatlari[12, 0] = 265; 572 | NoktaKoordinatlari[12, 1] = 437; 573 | NoktaKoordinatlari[13, 0] = 358; 574 | NoktaKoordinatlari[13, 1] = 34; 575 | NoktaKoordinatlari[14, 0] = 380; 576 | NoktaKoordinatlari[14, 1] = 144; 577 | NoktaKoordinatlari[15, 0] = 348; 578 | NoktaKoordinatlari[15, 1] = 232; 579 | NoktaKoordinatlari[16, 0] = 365; 580 | NoktaKoordinatlari[16, 1] = 355; 581 | NoktaKoordinatlari[17, 0] = 460; 582 | NoktaKoordinatlari[17, 1] = 81; 583 | NoktaKoordinatlari[18, 0] = 536; 584 | NoktaKoordinatlari[18, 1] = 135; 585 | NoktaKoordinatlari[19, 0] = 473; 586 | NoktaKoordinatlari[19, 1] = 206; 587 | NoktaKoordinatlari[20, 0] = 505; 588 | NoktaKoordinatlari[20, 1] = 341; 589 | NoktaKoordinatlari[21, 0] = 573; 590 | NoktaKoordinatlari[21, 1] = 41; 591 | NoktaKoordinatlari[22, 0] = 626; 592 | NoktaKoordinatlari[22, 1] = 150; 593 | NoktaKoordinatlari[23, 0] = 581; 594 | NoktaKoordinatlari[23, 1] = 265; 595 | NoktaKoordinatlari[24, 0] = 627; 596 | NoktaKoordinatlari[24, 1] = 432; 597 | } 598 | 599 | 600 | 601 | 602 | } 603 | } --------------------------------------------------------------------------------