コード例 #1
0
        public KnapsackProblem(Population initialPopulation, int backpackCapacity, int iterations, List <Item> items)
        {
            _backpackCapacity = backpackCapacity;
            _items            = items;
            _iterations       = iterations;

            BestEntities        = new List <double>(iterations);
            BestHistoryEntities = new List <double>(iterations);
            MeanPopulation      = new List <double>(iterations);

            initialPopulation.Initialize();

            _populations = new List <Population>(iterations)
            {
                initialPopulation
            };
        }