Exemple #1
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(inputFile);
     DiscreteSS ss = new DiscreteSS4QAP(instance, poolSize, refSetSize, explorationFactor);
     ss.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, ss.BestSolution);
     solution.Write(outputFile);
 }
 public void Start(string fileInput, string fileOutput, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(fileInput);
     int[] assignment = QAPUtils.GRCSolution(instance, 1.0);
     QAPUtils.LocalSearch2OptBest(instance, assignment);
     QAPSolution solution = new QAPSolution(instance, assignment);
     solution.Write(fileOutput);
 }
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(inputFile);
         int levelLength = (int) Math.Ceiling(levelLengthFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
     DiscreteHMSAwGRASP2OptFirst4QAP hm = new DiscreteHMSAwGRASP2OptFirst4QAP(instance, rclTreshold, graspIterations, initialSolutions, levelLength, tempReduction);
     hm.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, hm.BestSolution);
     solution.Write(outputFile);
 }
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(inputFile);
     MaxMinAntSystem aco = new MaxMinAntSystem2OptBest4QAP(instance, numberAnts, rho, alpha, beta, maxReinit);
     // Solving the problem and writing the best solution found.
     aco.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, aco.BestSolution);
     solution.Write(outputFile);
 }
Exemple #5
0
 public void Start(string fileInput, string fileOutput, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(fileInput);
     int levelLength = (int) Math.Ceiling(levelLengthFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
     DiscreteSA sa = new DiscreteSA4QAP(instance, initialSolutions, levelLength, tempReduction);
     sa.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, sa.BestSolution);
     solution.Write(fileOutput);
 }
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(inputFile);
     int neighborChecks = (int) Math.Ceiling(neighborChecksFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
     int tabuListLength = (int) Math.Ceiling(tabuListFactor * instance.NumberFacilities);
     DiscreteHMTSwGRASP2OptBest4QAP hm = new DiscreteHMTSwGRASP2OptBest4QAP(instance, rclTreshold, graspIterations, tabuListLength, neighborChecks);
     hm.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, hm.BestSolution);
     solution.Write(outputFile);
 }
Exemple #7
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(inputFile);
            DiscreteSS  ss       = new DiscreteSS2OptBest4QAP(instance, poolSize, refSetSize, explorationFactor);

            ss.Run(timeLimit - timePenalty);
            QAPSolution solution = new QAPSolution(instance, ss.BestSolution);

            solution.Write(outputFile);
        }
Exemple #8
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            int[] assignment = QAPUtils.GRCSolution(instance, 1.0);
            QAPUtils.LocalSearch2OptFirst(instance, assignment);
            QAPSolution solution = new QAPSolution(instance, assignment);

            solution.Write(fileOutput);
        }
Exemple #9
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            QAPInstance instance              = new QAPInstance(inputFile);
            int         levelLength           = (int)Math.Ceiling(levelLengthFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
            DiscreteHMSAwGRASP2OptBest4QAP hm = new DiscreteHMSAwGRASP2OptBest4QAP(instance, rclTreshold, graspIterations, initialSolutions, levelLength, tempReduction);

            hm.Run(timeLimit - timePenalty);
            QAPSolution solution = new QAPSolution(instance, hm.BestSolution);

            solution.Write(outputFile);
        }
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            QAPInstance     instance = new QAPInstance(inputFile);
            MaxMinAntSystem aco      = new MaxMinAntSystem2OptBest4QAP(instance, numberAnts, rho, alpha, beta, maxReinit);

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

            solution.Write(outputFile);
        }
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance    = new QAPInstance(fileInput);
            int         levelLength = (int)Math.Ceiling(levelLengthFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
            DiscreteSA  sa          = new DiscreteSA4QAP(instance, initialSolutions, levelLength, tempReduction);

            sa.Run(timeLimit - timePenalty);
            QAPSolution solution = new QAPSolution(instance, sa.BestSolution);

            solution.Write(fileOutput);
        }
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the GRASP for this instance of the problem.
            DiscreteGRASP grasp = new DiscreteGRASP2OptBest4QAP(instance, rclThreshold);

            // Solving the problem and writing the best solution found.
            grasp.Run(timeLimit - (int)timePenalty, RunType.TimeLimit);
            QAPSolution solution = new QAPSolution(instance, grasp.BestSolution);
            solution.Write(fileOutput);
        }
Exemple #13
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            QAPInstance instance       = new QAPInstance(inputFile);
            int         neighborChecks = (int)Math.Ceiling(neighborChecksFactor * (instance.NumberFacilities * (instance.NumberFacilities - 1)));
            int         tabuListLength = (int)Math.Ceiling(tabuListFactor * instance.NumberFacilities);
            DiscreteTS  ts             = new DiscreteTS4QAP(instance, rclTreshold, tabuListLength, neighborChecks);

            ts.Run(timeLimit - timePenalty);
            QAPSolution solution = new QAPSolution(instance, ts.BestSolution);

            solution.Write(outputFile);
        }
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the GRASP for this instance of the problem.
            DiscreteGRASP grasp = new DiscreteGRASP2OptBest4QAP(instance, rclThreshold);

            // Solving the problem and writing the best solution found.
            grasp.Run(timeLimit - (int)timePenalty, RunType.TimeLimit);
            QAPSolution solution = new QAPSolution(instance, grasp.BestSolution);

            solution.Write(fileOutput);
        }
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     QAPInstance instance = new QAPInstance(inputFile);
     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;
     }
     DiscreteILS ils = new DiscreteILS2OptFirst4QAP(instance, restartIterations, lowerBounds, upperBounds);
     ils.Run(timeLimit - timePenalty);
     QAPSolution solution = new QAPSolution(instance, ils.BestSolution);
     solution.Write(outputFile);
 }
Exemple #16
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(inputFile);

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

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

            solution.Write(outputFile);
        }
Exemple #17
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);
        }
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the PSO 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;
            }
            DiscretePSO pso = new DiscretePSO2OptBest4QAP(instance, (int)particlesCount, prevConf, neighConf, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            pso.Run(timeLimit - (int)timePenalty);
            QAPSolution solution = new QAPSolution(instance, pso.BestPosition);
            solution.Write(fileOutput);
        }
        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 DiscreteUMDA2OptBest4QAP(instance, popSize, truncFactor, lowerBounds, upperBounds);

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

            // Setting the parameters of the GA 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;
            }
            DiscreteGA genetic = new DiscreteGA2OptFirst4QAP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds);

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

            solution.Write(fileOutput);
        }
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            QAPInstance instance = new QAPInstance(fileInput);

            // Setting the parameters of the PSO 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;
            }
            DiscretePSO pso = new DiscretePSO2OptBest4QAP(instance, (int)particlesCount, prevConf, neighConf, lowerBounds, upperBounds);

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

            solution.Write(fileOutput);
        }
        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 DiscreteUMDA4QAP(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);
        }