Пример #1
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     TSPInstance instance = new TSPInstance(inputFile);
     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;
     }
     DiscreteILS ils = new DiscreteILS2OptBest4TSP(instance, restartIterations, lowerBounds, upperBounds);
     ils.Run(timeLimit - timePenalty);
     TSPSolution solution = new TSPSolution(instance, ils.BestSolution);
     solution.Write(outputFile);
 }
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            TSPInstance instance = new TSPInstance(inputFile);

            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;
            }
            DiscreteILS ils = new DiscreteILS2OptBest4TSP(instance, restartIterations, lowerBounds, upperBounds);

            ils.Run(timeLimit - timePenalty);
            TSPSolution solution = new TSPSolution(instance, ils.BestSolution);

            solution.Write(outputFile);
        }