Example #1
0
 def test_help_solvers(self):
     with capture_output() as OUT:
         help_solvers()
     OUT = OUT.getvalue()
     self.assertTrue(re.search('Pyomo Solvers and Solver Managers', OUT))
     self.assertTrue(re.search('Serial Solver', OUT))
     # Test known solvers and metasolver flags
     # ASL is a metasolver
     self.assertTrue(re.search('\n   \*asl ', OUT))
     # PS is bundles with Pyomo so should always be available
     self.assertTrue(re.search('\n   \+ps ', OUT))
     for solver in ('ipopt', 'cbc', 'glpk'):
         s = SolverFactory(solver)
         if s.available():
             self.assertTrue(
                 re.search("\n   \+%s " % solver, OUT),
                 "'   +%s' not found in help --solvers" % solver)
         else:
             self.assertTrue(
                 re.search("\n    %s " % solver, OUT),
                 "'    %s' not found in help --solvers" % solver)
     for solver in ('baron', ):
         s = SolverFactory(solver)
         if s.license_is_valid():
             self.assertTrue(
                 re.search("\n   \+%s " % solver, OUT),
                 "'   +%s' not found in help --solvers" % solver)
         elif s.available():
             self.assertTrue(
                 re.search("\n   \-%s " % solver, OUT),
                 "'   -%s' not found in help --solvers" % solver)
         else:
             self.assertTrue(
                 re.search("\n    %s " % solver, OUT),
                 "'    %s' not found in help --solvers" % solver)
Example #2
0
 def test_help_solvers(self):
     with capture_output() as OUT:
         help_solvers()
     OUT = OUT.getvalue()
     self.assertTrue(re.search('Pyomo Solvers and Solver Managers', OUT))
     self.assertTrue(re.search('Serial Solver', OUT))
     # Test known solvers and metasolver flags
     # ASL is a metasolver
     self.assertTrue(re.search('asl +\+', OUT))
     # PS is bundles with Pyomo so should always be available
     self.assertTrue(re.search('ps +\*', OUT))
     for solver in ('ipopt','baron','cbc','glpk'):
         s = SolverFactory(solver)
         if s.available():
             self.assertTrue(re.search("%s +\* [a-zA-Z]" % solver, OUT))
         else:
             self.assertTrue(re.search("%s +[a-zA-Z]" % solver, OUT))
Example #3
0
 def test_help_solvers(self):
     with capture_output() as OUT:
         help_solvers()
     OUT = OUT.getvalue()
     self.assertTrue(re.search('Pyomo Solvers and Solver Managers', OUT))
     self.assertTrue(re.search('Serial Solver', OUT))
     # Test known solvers and metasolver flags
     # ASL is a metasolver
     self.assertTrue(re.search('asl +\+', OUT))
     # PS is bundles with Pyomo so should always be available
     self.assertTrue(re.search('ps +\*', OUT))
     for solver in ('ipopt','baron','cbc','glpk'):
         s = SolverFactory(solver)
         if s.available():
             self.assertTrue(re.search("%s +\* [a-zA-Z]" % solver, OUT))
         else:
             self.assertTrue(re.search("%s +[a-zA-Z]" % solver, OUT))