'Test a hard knapsack problem with CBC.'

def test_hard_mip(self):

    if (CBC in installed_solvers()):
        n = 50
        c = 995
        z = 8373
        coeffs = [[1, 94, 485, 0], [2, 506, 326, 0], [3, 416, 248, 0], [4, 992, 421, 0], [5, 649, 322, 0], [6, 237, 795, 0], [7, 457, 43, 1], [8, 815, 845, 0], [9, 446, 955, 0], [10, 422, 252, 0], [11, 791, 9, 1], [12, 359, 901, 0], [13, 667, 122, 1], [14, 598, 94, 1], [15, 7, 738, 0], [16, 544, 574, 0], [17, 334, 715, 0], [18, 766, 882, 0], [19, 994, 367, 0], [20, 893, 984, 0], [21, 633, 299, 0], [22, 131, 433, 0], [23, 428, 682, 0], [24, 700, 72, 1], [25, 617, 874, 0], [26, 874, 138, 1], [27, 720, 856, 0], [28, 419, 145, 0], [29, 794, 995, 0], [30, 196, 529, 0], [31, 997, 199, 1], [32, 116, 277, 0], [33, 908, 97, 1], [34, 539, 719, 0], [35, 707, 242, 0], [36, 569, 107, 0], [37, 537, 122, 0], [38, 931, 70, 1], [39, 726, 98, 1], [40, 487, 600, 0], [41, 772, 645, 0], [42, 513, 267, 0], [43, 81, 972, 0], [44, 943, 895, 0], [45, 58, 213, 0], [46, 303, 748, 0], [47, 764, 487, 0], [48, 536, 923, 0], [49, 724, 29, 1], [50, 789, 674, 0]]
        X = Bool(n)
        prob = Problem(Maximize(sum_entries(mul_elemwise([i[1] for i in coeffs], X))), [(sum_entries(mul_elemwise([i[2] for i in coeffs], X)) <= c)])
        prob.solve(verbose=False, solver=CBC)
        self.assertAlmostEqual(prob.value, z)
    else:
        with self.assertRaises(Exception) as cm:
            prob = Problem(Minimize(norm(self.x, 1)), [(self.x == 0)])
            prob.solve(solver=CBC, verbose=False)
        self.assertEqual(str(cm.exception), ('The    solver    %s    is    not    installed.' % CBC))
