'Test the CVXOPT solver.'

def test_cvxopt(self):

    if (CVXOPT in installed_solvers()):
        w = Variable(2)
        M = np.matrix([[1.0, 0.1], [0.0, 0.0], [0.0, 0.8], [0.0, 0.1]])
        Mw = (M * w)
        lower_bound = (Mw >= np.array([(-0.5), (-0.5), (-0.5), (-0.5)]))
        upper_bound = (Mw <= np.array([0.5, 0.5, 0.5, 0.5]))
        objective = Minimize(norm2((w - np.array([0.4, 1.2]))))
        problem = Problem(objective, [lower_bound, upper_bound])
        problem.solve(solver='CVXOPT')
        low_dual = lower_bound.dual_value
        high_dual = upper_bound.dual_value
        problem.solve(solver=ECOS)
        self.assertItemsAlmostEqual(lower_bound.dual_value, low_dual)
        self.assertItemsAlmostEqual(upper_bound.dual_value, high_dual)
