コード例 #1
0
 def test_relation_with_offset_to_string(self):
     e = lp.Expression({'x1': 4}, -20)
     r = lp.Relation(lp.Relation.Less, e)
     self.assertEqual(str(r), '4*x1 <= 20')
コード例 #2
0
 def test_relation_without_offset_to_string(self):
     e = lp.Expression({'x1': 1})
     r = lp.Relation(lp.Relation.Equals, e)
     self.assertEqual(str(r), 'x1 == 0')
コード例 #3
0
 def test_create_relation(self):
     e = lp.Expression({'x1': 4})
     r = lp.Relation(lp.Relation.Greater, e)
     self.assertEqual(r.expression, e)
     self.assertEqual(r.sense, lp.Relation.Greater)