示例#1
0
        public void Item_generate()
        {
            var bagSize = 5;
            var C       = 10;
            var seed    = 609;
            var testBag = new Knapsack(bagSize, C, seed);

            testBag.GenerateItems();
            Assert.AreEqual(testBag.ItemSize, 5);
        }
示例#2
0
        public void Test_ValueSum3()
        {
            var bagSize = 5;
            var C       = 10;
            var seed    = 609;
            var testBag = new Knapsack(bagSize, C, seed);

            testBag.GenerateItems();
            testBag.SortTheItems();
            testBag.FitTheItemsInTheBag();
            testBag.PrintTheBag();
            Assert.AreEqual(testBag.ValueSum, 14);
        }
示例#3
0
        public void Test_ValueSum1()
        {
            var bagSize = 30;
            var C       = 20;
            var seed    = 2137;
            var testBag = new Knapsack(bagSize, C, seed);

            testBag.GenerateItems();
            testBag.SortTheItems();
            testBag.FitTheItemsInTheBag();
            testBag.PrintTheBag();
            Assert.AreEqual(testBag.ValueSum, 61);
        }