public void Run5ItemTestLargeWeightCombinations(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 5, 500); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(16, test.OptimalSolution.Result.Value); Assert.Equal(18, test.OptimalSolution.Result.Weight); Assert.Equal(17, test.OptimalSolution.Result.Volume); }
public void Run5ItemTestMidWeightDynamic(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 5, 10); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(12, test.OptimalSolution.Result.Value); Assert.Equal(9, test.OptimalSolution.Result.Weight); Assert.Equal(9, test.OptimalSolution.Result.Volume); Assert.Equal(3, test.OptimalSolution.Solution.Count); }
public void OneD_Mid_10_Items(TestType type) { KnapsackTestManager TM = CreateTestManager(TestData.KSItemList, 10, 100); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = TM.RunTest(test); Assert.Equal(217, test.OptimalSolution.Result.Value); Assert.Equal(90, test.OptimalSolution.Result.Weight); Assert.Equal(167, test.OptimalSolution.Result.Volume); Assert.Equal(6, test.OptimalSolution.Solution.Count); long testSolutionCnt = TestSolutions(type, TM.ItemList.Count, TM.MaxWeight, TM.MaxVolume); Assert.Equal(testSolutionCnt, test.SolutionCount); }
public void TwoD_Zero_10Items(TestType type) { KnapsackTestManager TM = CreateTestManager(TestData.KSItemList, 10, 0, 0); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = TM.RunTest(test); Assert.Equal(0, test.OptimalSolution.Result.Value); Assert.Equal(0, test.OptimalSolution.Result.Weight); Assert.Equal(0, test.OptimalSolution.Result.Volume); Assert.Empty(test.OptimalSolution.Solution); long testSolutionCnt = TestSolutions(type, TM.ItemList.Count, TM.MaxWeight, TM.MaxVolume); Assert.Equal(testSolutionCnt, test.SolutionCount); }
public void TwoD_Mid_2_25_Items(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 25, 425, 550); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(664, test.OptimalSolution.Result.Value); Assert.Equal(422, test.OptimalSolution.Result.Weight); Assert.Equal(517, test.OptimalSolution.Result.Volume); Assert.Equal(21, test.OptimalSolution.Solution.Count); long testSolutionCnt = TestSolutions(type, tm); Assert.Equal(testSolutionCnt, test.SolutionCount); }
public void TwoD_Large_20_Items(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 20, 1000, 440); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(554, test.OptimalSolution.Result.Value); Assert.Equal(426, test.OptimalSolution.Result.Weight); Assert.Equal(437, test.OptimalSolution.Result.Volume); Assert.Equal(18, test.OptimalSolution.Solution.Count); long testSolutionCnt = TestSolutions(type, tm); Assert.Equal(testSolutionCnt, test.SolutionCount); }
public void TwoD_Mid_11_Items(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 11, 100, 150); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(208, test.OptimalSolution.Result.Value); Assert.Equal(87, test.OptimalSolution.Result.Weight); Assert.Equal(135, test.OptimalSolution.Result.Volume); Assert.Equal(6, test.OptimalSolution.Solution.Count); long testSolutionCnt = TestSolutions(type, tm); Assert.Equal(testSolutionCnt, test.SolutionCount); }
public void TwoD_Large_10_Items(TestType type) { KnapsackTestManager tm = CreateTestManager(TestData.KSItemList, 10, 500, 220); KnapSackTest test = (KnapSackTest)CreateTest(type); TimeSpan t = tm.RunTest(test); Assert.Equal(290, test.OptimalSolution.Result.Value); Assert.Equal(156, test.OptimalSolution.Result.Weight); Assert.Equal(209, test.OptimalSolution.Result.Volume); Assert.Equal(9, test.OptimalSolution.Solution.Count); long testSolutionCnt = TestSolutions(type, tm); Assert.Equal(testSolutionCnt, test.SolutionCount); }