def test_installed_solvers(self): """Test the list of installed solvers. """ from cvxpy.problems.solvers.utilities import SOLVERS prob = Problem(Minimize(norm(self.x, 1)), [self.x == 0]) for solver in SOLVERS.keys(): if solver in installed_solvers(): prob.solve(solver=solver) self.assertItemsAlmostEqual(self.x.value, [0, 0]) else: with self.assertRaises(Exception) as cm: prob.solve(solver = solver) self.assertEqual(str(cm.exception), "The solver %s is not installed." % solver)
def test_installed_solvers(self): """Test the list of installed solvers. """ from cvxpy.problems.solvers.utilities import SOLVERS prob = Problem(Minimize(norm(self.x, 1)), [self.x == 0]) for solver in SOLVERS.keys(): if solver in installed_solvers(): prob.solve(solver=solver) self.assertItemsAlmostEqual(self.x.value, [0, 0]) else: with self.assertRaises(Exception) as cm: prob.solve(solver=solver) self.assertEqual(str(cm.exception), "The solver %s is not installed." % solver)
def test_installed_solvers(self): """Test the list of installed solvers. """ from cvxpy.problems.solvers.utilities import SOLVERS prob = Problem(Minimize(norm(self.x, 1)), [self.x == 0]) for solver in list(SOLVERS.keys()): if solver in installed_solvers(): try: prob.solve(solver=solver) self.assertItemsAlmostEqual(self.x.value, [0, 0]) # LS is the only solver that can't handle this problem except (Exception) as cm: self.assertEqual( str(cm), "The solver LS cannot solve the problem.") else: with self.assertRaises(Exception) as cm: prob.solve(solver=solver) self.assertEqual(str(cm.exception), "The solver %s is not installed." % solver)
def _reset_cache(self): """Resets the cached data. """ for solver_name in SOLVERS.keys(): self._cached_data[solver_name] = ProblemData() self._cached_data[s.PARALLEL] = CachedProblem(None, None)
def _reset_cache(self): """Resets the cached data. """ for solver_name in SOLVERS.keys(): self._cached_data[solver_name] = ProblemData()