public void RunSimulation(Map map) { // Get number of clients on the map (without depo) int numberOfClients = map.Locations.Count - 1; // Get max possible value based on due date of depo // Double maxValue = Convert.ToDouble(map.Locations.First().DueDate); // Set an absurdly high maxValue Double maxValue = 8000; // Set min possible value as 1.0 - impossible to achieve, but not illegal. Double minValue = 1.0; // Generate random initial chromosomes for (int i = 0; i < PopulationSize; i++) { /*Solutions[i] = new Chromosome(numberOfClients); do { Solutions[i].MakeRandomChromosome(); Solutions[i].FitnessFunction(map); } while (Solutions[i].Fitness < 0);*/ Chromosome c = new Chromosome(numberOfClients); do { c.MakeRandomChromosome(); c.Fitness = c.FitnessFunction(map); } while (c.Fitness < 0); Solutions.Add(c); } for (int i = 0; i < Generations; i++) { Solutions = geneticRoulette.createNewGeneration(Solutions, maxValue, minValue, map); if (checkStopConditions() == true) break; //Chromosome ch = GetBestSolutionFound(); //Console.WriteLine("best " + ch.FitnessFunction(map) + ", routes " + ch.Routes.Count()); } }