Esempio n. 1
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            SPPInstance instance = new SPPInstance(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.NumberSubsets - 1;
            }
            DiscreteMA memetic = new DiscreteMA4SPP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            memetic.Run(timeLimit);
            SPPSolution solution = new SPPSolution(instance, memetic.BestIndividual);
            solution.Write(fileOutput);
        }
Esempio n. 2
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            SPPInstance instance = new SPPInstance(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.NumberSubsets - 1;
            }
            DiscreteMA memetic = new DiscreteMA4SPP(instance, (int)popSize, mutProbability, lowerBounds, upperBounds);

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

            solution.Write(fileOutput);
        }