public void Start(string fileInput, string fileOutput, int timeLimit) { TSPInstance instance = new TSPInstance(fileInput); // Setting the parameters of the GA for this instance of the problem. int[] lowerBounds = new int[instance.NumberCities]; int[] upperBounds = new int[instance.NumberCities]; for (int i = 0; i < instance.NumberCities; i++) { lowerBounds[i] = 0; upperBounds[i] = instance.NumberCities - 1; } DiscreteGA genetic = new DiscreteGA2OptBest4TSP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds); // Solving the problem and writing the best solution found. genetic.Run(timeLimit - (int)timePenalty); TSPSolution solution = new TSPSolution(instance, genetic.BestIndividual); solution.Write(fileOutput); }
public void Start(string fileInput, string fileOutput, int timeLimit) { TSPInstance instance = new TSPInstance(fileInput); // Setting the parameters of the GA for this instance of the problem. int[] lowerBounds = new int[instance.NumberCities]; int[] upperBounds = new int[instance.NumberCities]; for (int i = 0; i < instance.NumberCities; i++) { lowerBounds[i] = 0; upperBounds[i] = instance.NumberCities - 1; } DiscreteGA genetic = new DiscreteGA2OptBest4TSP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds); // Solving the problem and writing the best solution found. genetic.Run(timeLimit - (int)timePenalty); TSPSolution solution = new TSPSolution(instance, genetic.BestIndividual); solution.Write(fileOutput); }