Exemplo n.º 1
0
        public List <Function> GenerateStartPopulation(int capacity)
        {
            var solutions = new List <Function>();

            for (var i = 0; i < (capacity) / 2; i++)
            {
                var solution = new Function(_fGen.GenerateFullInit(_ffabric, _maxDepth));
                while (CalculateFunctionValue(solution) == Int32.MaxValue)
                {
                    solution = new Function(_fGen.GenerateFullInit(_ffabric, _maxDepth));
                }
                solutions.Add(solution);
            }

            for (var i = 0; i < (capacity) / 2; i++)
            {
                var solution = new Function(_fGen.GenerateGrowthInit(_ffabric, _maxDepth));
                while (CalculateFunctionValue(solution) == Int32.MaxValue)
                {
                    solution = new Function(_fGen.GenerateGrowthInit(_ffabric, _maxDepth));
                }
                solutions.Add(solution);
            }

            return(solutions);
        }