Пример #1
0
 def test_expr_to_grb_expr_w_expr(self):
     model = grb.Model()
     prob = Prob(model)
     expr = Expr(f)
     bexpr = BoundExpr(f, None)
     with self.assertRaises(Exception) as e:
         prob._expr_to_grb_expr(bexpr)
     self.assertTrue("Expression cannot be converted" in e.exception.message)
Пример #2
0
 def test_expr_to_grb_expr_w_expr(self):
     model = grb.Model()
     prob = Prob(model)
     expr = Expr(f)
     bexpr = BoundExpr(f, None)
     with self.assertRaises(Exception) as e:
         prob._expr_to_grb_expr(bexpr)
     self.assertTrue(
         "Expression cannot be converted" in e.exception.message)
Пример #3
0
 def test_expr_to_grb_expr_w_comp_expr(self):
     model = grb.Model()
     prob = Prob(model)
     aff = AffExpr(-2 * np.ones((1, 1)), np.zeros((1, 1)))
     val = np.zeros((1, 1))
     cexpr = CompExpr(aff, val)
     bexpr = BoundExpr(cexpr, None)
     with self.assertRaises(Exception) as e:
         prob._expr_to_grb_expr(bexpr)
     self.assertTrue("Comparison" in e.exception.message)
Пример #4
0
 def test_expr_to_grb_expr_w_comp_expr(self):
     model = grb.Model()
     prob = Prob(model)
     aff = AffExpr(-2*np.ones((1,1)), np.zeros((1,1)))
     val = np.zeros((1,1))
     cexpr = CompExpr(aff, val)
     bexpr = BoundExpr(cexpr, None)
     with self.assertRaises(Exception) as e:
         prob._expr_to_grb_expr(bexpr)
     self.assertTrue("Comparison" in e.exception.message)