/// <summary> /// Main loop of ACS algorithm /// </summary> public List <double> RunACS() { Stopwatch.Start(); Graph.ResetPheromone(Parameters.T0); for (int i = 0; i < Parameters.Iterations; i++) { List <Ant> antColony = CreateAnts(); GlobalBestAnt = GlobalBestAnt ?? antColony[0]; Ant localBestAnt = BuildTours(antColony); if (Math.Round(localBestAnt.Distance, 2) < Math.Round(GlobalBestAnt.Distance, 2)) { GlobalBestAnt = localBestAnt; Console.WriteLine("Current Global Best: " + GlobalBestAnt.Distance + " found in " + i + " iteration"); } Results.Add(localBestAnt.Distance); } Stopwatch.Stop(); return(Results); }