-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
29 lines (24 loc) · 1.04 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
namespace AntColonySystem
{
class Program
{
static void Main(string[] args)
{
List<Point> points = TspFileReader.ReadTspFile(@"TSP\kroA100.tsp"); // Parse TSPlib file and load as List<Point>
Graph graph = new Graph(points, true); // Create Graph
GreedyAlgorithm greedyAlgorithm = new GreedyAlgorithm(graph);
double greedyShortestTourDistance = greedyAlgorithm.Run(); // get shortest tour using greedy algorithm
Parameters parameters = new Parameters() // Most parameters will be default. We only have to set T0 (initial pheromone level)
{
T0 = (1.0 / (graph.Dimensions * greedyShortestTourDistance))
};
parameters.Show();
Solver solver = new Solver(parameters, graph);
List<double> results = solver.RunACS(); // Run ACS
Console.WriteLine("Time: " + solver.GetExecutionTime());
Console.ReadLine();
}
}
}