Beispiel #1
0
        public void TestSmall()
        {
            var ks = new Knapsack();

            var items = new[]
            {
                new Item()
                {
                    Value = 3, Weight = 4
                },
                new Item()
                {
                    Value = 2, Weight = 3
                },
                new Item()
                {
                    Value = 4, Weight = 2
                },
                new Item()
                {
                    Value = 4, Weight = 2
                },
            };

            var res = ks.Compute(items, 6);

            Assert.That(res, Is.EqualTo(8));
        }