Exemplo n.º 1
0
 public void Start(string fileInput, string fileOutput, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(fileInput);
     int[] ordering = TwoSPUtils.DecreasingArea(instance);
     int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, ordering);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(fileOutput);
 }
Exemplo n.º 2
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(inputFile);
     DiscreteSS ss = new DiscreteSSNPS42SP(instance, poolSize, refSetSize, explorationFactor);
     ss.Run(timeLimit - timePenalty);
     int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, ss.BestSolution);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(outputFile);
 }
Exemplo n.º 3
0
 public void Start(string fileInput, string fileOutput, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(fileInput);
     int[] ordering = TwoSPUtils.DecreasingWidth(instance);
     TwoSPUtils.BLLocalSearch2OptBest(instance, ordering);
     int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ordering);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(fileOutput);
 }
Exemplo n.º 4
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(inputFile);
     MaxMinAntSystem aco = new MaxMinAntSystemBL2OptBest42SP(instance, numberAnts, rho, alpha, beta, maxReinit);
     // Solving the problem and writing the best solution found.
     aco.Run(timeLimit - timePenalty);
     int[,] coordinates = TwoSPUtils.BLCoordinates(instance, aco.BestSolution);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(outputFile);
 }
Exemplo n.º 5
0
 public void Start(string fileInput, string fileOutput, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(fileInput);
     int levelLength = (int) Math.Ceiling(levelLengthFactor * (2 * instance.NumberItems));
     DiscreteSA sa = new DiscreteSABL42SP(instance, initialSolutions, levelLength, tempReduction);
     sa.Run(timeLimit - timePenalty);
     int[,] coordinates = TwoSPUtils.BLCoordinates(instance, sa.BestSolution);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(fileOutput);
 }
Exemplo n.º 6
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

            int[] ordering = TwoSPUtils.DecreasingArea(instance);
            int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, ordering);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }
Exemplo n.º 7
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(inputFile);
     int neighborChecks = (int) Math.Ceiling(neighborChecksFactor * (2 * instance.NumberItems));
     int tabuListLength = (int) Math.Ceiling(tabuListFactor * instance.NumberItems);
     DiscreteTS ts = new DiscreteTSBL42SP(instance, tabuListLength, neighborChecks);
     ts.Run(timeLimit - timePenalty);
     int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ts.BestSolution);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(outputFile);
 }
Exemplo n.º 8
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(inputFile);
            DiscreteSS    ss       = new DiscreteSSBL42SP(instance, poolSize, refSetSize, explorationFactor);

            ss.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ss.BestSolution);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

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

            int[] ordering = TwoSPUtils.DecreasingWidth(instance);
            TwoSPUtils.BLLocalSearch2OptFirst(instance, ordering);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ordering);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }
Exemplo n.º 10
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            TwoSPInstance   instance = new TwoSPInstance(inputFile);
            MaxMinAntSystem aco      = new MaxMinAntSystemNPS42SP(instance, numberAnts, rho, alpha, beta, maxReinit);

            // Solving the problem and writing the best solution found.
            aco.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, aco.BestSolution);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(outputFile);
        }
Exemplo n.º 11
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance    = new TwoSPInstance(fileInput);
            int           levelLength = (int)Math.Ceiling(levelLengthFactor * (2 * instance.NumberItems));
            DiscreteSA    sa          = new DiscreteSABL42SP(instance, initialSolutions, levelLength, tempReduction);

            sa.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, sa.BestSolution);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }
Exemplo n.º 12
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            TwoSPInstance instance       = new TwoSPInstance(inputFile);
            int           neighborChecks = (int)Math.Ceiling(neighborChecksFactor * (2 * instance.NumberItems));
            int           tabuListLength = (int)Math.Ceiling(tabuListFactor * instance.NumberItems);
            DiscreteTS    ts             = new DiscreteTSNPS42SP(instance, tabuListLength, neighborChecks);

            ts.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, ts.BestSolution);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(outputFile);
        }
Exemplo n.º 13
0
 public void Start(string inputFile, string outputFile, int timeLimit)
 {
     TwoSPInstance instance = new TwoSPInstance(inputFile);
     int[] lowerBounds = new int[instance.NumberItems];
     int[] upperBounds = new int[instance.NumberItems];
     for (int i = 0; i < instance.NumberItems; i++) {
         lowerBounds[i] = 0;
         upperBounds[i] = instance.NumberItems - 1;
     }
     DiscreteILS ils = new DiscreteILSBL2OptBest42SP(instance, restartIterations, lowerBounds, upperBounds);
     ils.Run(timeLimit - timePenalty);
     int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ils.BestSolution);
     TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
     solution.Write(outputFile);
 }
Exemplo n.º 14
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

            // Setting the parameters of the PSO for this instance of the problem.
            int[] lowerBounds = new int[instance.NumberItems];
            int[] upperBounds = new int[instance.NumberItems];
            for (int i = 0; i < instance.NumberItems; i++) {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberItems - 1;
            }
            DiscretePSO pso = new DiscretePSOBL42SP(instance, (int)particlesCount, prevConf, neighConf, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            pso.Run(timeLimit - (int)timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, pso.BestPosition);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
            solution.Write(fileOutput);
        }
Exemplo n.º 15
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

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

            // Solving the problem and writing the best solution found.
            memetic.Run(timeLimit - (int)timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, memetic.BestIndividual);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
            solution.Write(fileOutput);
        }
Exemplo n.º 16
0
        public void Start(string inputFile, string outputFile, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(inputFile);

            int[] lowerBounds = new int[instance.NumberItems];
            int[] upperBounds = new int[instance.NumberItems];
            for (int i = 0; i < instance.NumberItems; i++)
            {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberItems - 1;
            }
            DiscreteILS ils = new DiscreteILSBL2OptBest42SP(instance, restartIterations, perturbations, lowerBounds, upperBounds);

            ils.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, ils.BestSolution);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(outputFile);
        }
Exemplo n.º 17
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

            // Setting the parameters of the UMDA for this instance of the problem.
            int popSize = (int) Math.Ceiling(popFactor * instance.NumberItems);
            int[] lowerBounds = new int[instance.NumberItems];
            int[] upperBounds = new int[instance.NumberItems];
            for (int i = 0; i < instance.NumberItems; i++) {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberItems - 1;
            }
            DiscreteUMDA umda = new DiscreteUMDABL2OptBest42SP(instance, popSize, truncFactor, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            umda.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, umda.BestIndividual);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);
            solution.Write(fileOutput);
        }
Exemplo n.º 18
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

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

            // Solving the problem and writing the best solution found.
            memetic.Run(timeLimit - (int)timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, memetic.BestIndividual);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }
Exemplo n.º 19
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

            // Setting the parameters of the PSO for this instance of the problem.
            int[] lowerBounds = new int[instance.NumberItems];
            int[] upperBounds = new int[instance.NumberItems];
            for (int i = 0; i < instance.NumberItems; i++)
            {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberItems - 1;
            }
            DiscretePSO pso = new DiscretePSOBL2OptBest42SP(instance, (int)particlesCount, prevConf, neighConf, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            pso.Run(timeLimit - (int)timePenalty);
            int[,] coordinates = TwoSPUtils.BLCoordinates(instance, pso.BestPosition);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }
Exemplo n.º 20
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            TwoSPInstance instance = new TwoSPInstance(fileInput);

            // Setting the parameters of the UMDA for this instance of the problem.
            int popSize = (int)Math.Ceiling(popFactor * instance.NumberItems);

            int[] lowerBounds = new int[instance.NumberItems];
            int[] upperBounds = new int[instance.NumberItems];
            for (int i = 0; i < instance.NumberItems; i++)
            {
                lowerBounds[i] = 0;
                upperBounds[i] = instance.NumberItems - 1;
            }
            DiscreteUMDA umda = new DiscreteUMDANPS42SP(instance, popSize, truncFactor, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            umda.Run(timeLimit - timePenalty);
            int[,] coordinates = TwoSPUtils.NPSCoordinates(instance, umda.BestIndividual);
            TwoSPSolution solution = new TwoSPSolution(instance, coordinates);

            solution.Write(fileOutput);
        }