Exemplo n.º 1
0
 def test_log_infeasible_bounds(self):
     """Test for logging of infeasible variable bounds."""
     m = self.build_model()
     m.x.setlb(2)
     m.x.setub(0)
     output = StringIO()
     with LoggingIntercept(output, 'pyomo.util.infeasible', logging.INFO):
         log_infeasible_bounds(m)
     expected_output = ["VAR x: 1 < LB 2", "VAR x: 1 > UB 0"]
     self.assertEqual(expected_output, output.getvalue().splitlines())
Exemplo n.º 2
0
def print_infeasible_bounds(m, tol=1e-6, output_file=None):
    """
    print the infeasible variable bounds in the model
    """
    with _logging_handler(output_file) as logger:
        log_infeasible_bounds(m, tol=tol, logger=logger)