예제 #1
0
 def test_optimal_solution(self):
     sol = partition.solve_partition_greedy([1, 2, 3, 6])
     p1, p2 = sol
     self.assertNotEqual(p1, p2)
     expected_partitioning = [{0, 1, 2}, {3}]
     assert set(p1) in expected_partitioning
     assert set(p2) in expected_partitioning
예제 #2
0
 def test_suboptimal_solution(self):
     sol = partition.solve_partition_greedy([4, 5, 6, 7, 8])
     p1, p2 = sol
     self.assertNotEqual(p1, p2)
     expected_partitioning = [{0, 1, 4}, {2, 3}]
     assert set(p1) in expected_partitioning
     assert set(p2) in expected_partitioning