예제 #1
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            SPPInstance instance = new SPPInstance(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.NumberSubsets - 1;
            }
            DiscreteUMDA umda = new DiscreteUMDA4SPP(instance, popSize, truncFactor, lowerBounds, upperBounds);

            // Solving the problem and writing the best solution found.
            umda.Run(timeLimit - (int) timePenalty);
            SPPSolution solution = new SPPSolution(instance, umda.BestIndividual);
            solution.Write(fileOutput);
        }
예제 #2
0
        public void Start(string fileInput, string fileOutput, int timeLimit)
        {
            SPPInstance instance = new SPPInstance(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.NumberSubsets - 1;
            }
            DiscreteUMDA umda = new DiscreteUMDA4SPP(instance, popSize, truncFactor, lowerBounds, upperBounds);

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

            solution.Write(fileOutput);
        }