Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 def _reset_cache(self):
     """Resets the cached data.
     """
     for solver_name in SOLVERS.keys():
         self._cached_data[solver_name] = ProblemData()
Exemplo n.º 6
0
 def _reset_cache(self):
     """Resets the cached data.
     """
     for solver_name in SOLVERS.keys():
         self._cached_data[solver_name] = ProblemData()
Exemplo n.º 7
0
 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)