示例#1
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the MA for this instance of the problem.
            int[] lowerBounds = new int[instance.NumberFacilities];
            int[] upperBounds = new int[instance.NumberFacilities];
            for (int i = 0; i < instance.NumberFacilities; i++) {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberFacilities - 1;
            }
            DiscreteMA memetic = new DiscreteMA4QAP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            memetic.Run(timeLimit - (int)timePenalty);
            QAPSolution solution = new QAPSolution(instance, memetic.BestIndividual);
            solution.Write(fileOutput);
        }
示例#2
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the MA for this instance of the problem.
            int[] lowerBounds = new int[instance.NumberFacilities];
            int[] upperBounds = new int[instance.NumberFacilities];
            for (int i = 0; i < instance.NumberFacilities; i++)
            {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberFacilities - 1;
            }
            DiscreteMA memetic = new DiscreteMA4QAP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            memetic.Run(timeLimit - (int)timePenalty);
            QAPSolution solution = new QAPSolution(instance, memetic.BestIndividual);

            solution.Write(fileOutput);
        }