-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·29 lines (25 loc) · 1017 Bytes
/
Program.cs
File metadata and controls
executable file
·29 lines (25 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace GeneticAlgorithm4TSP
{
class Program
{
static void Main(string[] args)
{
Map.PickMap(GA.fileName, GA.numCities);
Population pop = new Population(GA.popSize, true);
System.Console.WriteLine("Mutation Probability: " + GA.mutRate);
System.Console.WriteLine("Iterations: " + GA.iterations);
System.Console.WriteLine("Population Size: " + GA.popSize);
System.Console.WriteLine("Initial distance: " + pop.getFittest().getDistance());
pop = GA.evolvePopulation(pop);
for (int i = 0; i < GA.iterations; i++)
{
pop = GA.evolvePopulation(pop);
}
System.Console.WriteLine("Finished");
System.Console.WriteLine("Final distance: " + pop.getFittest().getDistance());
System.Console.WriteLine("Solution:");
System.Console.WriteLine(pop.getFittest());
System.Console.ReadKey();
}
}
}