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

            // Setting the parameters of the UMDA for this instance of the problem.
            int popSize = (int) Math.Ceiling(popFactor * instance.NumberFacilities);
            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;
            }
            DiscreteUMDA umda = new DiscreteUMDA2OptFirst4QAP(instance, popSize, truncFactor, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            umda.Run(timeLimit - (int) timePenalty);
            QAPSolution solution = new QAPSolution(instance, umda.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 UMDA for this instance of the problem.
            int popSize = (int)Math.Ceiling(popFactor * instance.NumberFacilities);

            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;
            }
            DiscreteUMDA umda = new DiscreteUMDA2OptFirst4QAP(instance, popSize, truncFactor, lowerBounds, upperBounds);

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

            solution.Write(fileOutput);
        }