Changeset 9493
 Timestamp:
 Dec 14, 2014 10:52:09 PM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

pyomo/trunk/pyomo/core/tests/transform/test_transform.py
r9486 r9493 37 37 return False 38 38 39 @unittest.expectedFailure40 39 def test_relax_integrality1(self): 41 """ Coverage of the _clear_attribute method """40 # Coverage of the _clear_attribute method 42 41 self.model.A = RangeSet(1,4) 43 42 self.model.a = Var() … … 48 47 self.model.f = Var(domain=Boolean) 49 48 instance=self.model.create() 50 rinst = apply_transformation(' relax_integrality',instance)49 rinst = apply_transformation('base.relax_integrality',instance) 51 50 self.assertEqual(type(rinst.a.domain), type(Reals)) 52 self.assertEqual(type(rinst.b.domain), type(Reals))53 self.assertEqual(type(rinst.c.domain), type(Reals))51 self.assertEqual(type(rinst.b.domain), RealInterval) 52 self.assertEqual(type(rinst.c.domain), RealInterval) 54 53 self.assertEqual(type(rinst.d.domain), type(Reals)) 55 self.assertEqual(type(rinst.e.domain), type(Reals))56 self.assertEqual(type(rinst.f.domain), type(Reals))54 self.assertEqual(type(rinst.e.domain), RealInterval) 55 self.assertEqual(type(rinst.f.domain), RealInterval) 57 56 self.assertEqual(rinst.a.bounds, instance.a.bounds) 58 57 self.assertEqual(rinst.b.bounds, instance.b.bounds) … … 61 60 self.assertEqual(rinst.e.bounds, instance.e.bounds) 62 61 self.assertEqual(rinst.f.bounds, instance.f.bounds) 62 63 def test_relax_integrality2(self): 64 # Coverage of the _clear_attribute method 65 self.model.A = RangeSet(1,4) 66 self.model.a = Var([1,2,3]) 67 self.model.b = Var([1,2,3], within=self.model.A) 68 self.model.c = Var([1,2,3], within=NonNegativeIntegers) 69 self.model.d = Var([1,2,3], within=Integers, bounds=(2,3)) 70 self.model.e = Var([1,2,3], within=Boolean) 71 self.model.f = Var([1,2,3], domain=Boolean) 72 instance=self.model.create() 73 rinst = apply_transformation('base.relax_integrality',instance) 74 self.assertEqual(type(rinst.a[1].domain), type(Reals)) 75 self.assertEqual(type(rinst.b[1].domain), RealInterval) 76 self.assertEqual(type(rinst.c[1].domain), RealInterval) 77 self.assertEqual(type(rinst.d[1].domain), type(Reals)) 78 self.assertEqual(type(rinst.e[1].domain), RealInterval) 79 self.assertEqual(type(rinst.f[1].domain), RealInterval) 80 self.assertEqual(rinst.a[1].bounds, instance.a[1].bounds) 81 self.assertEqual(rinst.b[1].bounds, instance.b[1].bounds) 82 self.assertEqual(rinst.c[1].bounds, instance.c[1].bounds) 83 self.assertEqual(rinst.d[1].bounds, instance.d[1].bounds) 84 self.assertEqual(rinst.e[1].bounds, instance.e[1].bounds) 85 self.assertEqual(rinst.f[1].bounds, instance.f[1].bounds) 63 86 64 87 def test_apply_transformation1(self):
Note: See TracChangeset
for help on using the changeset viewer.