Changeset 1975
- Timestamp:
- Dec 7, 2009 6:47:43 PM (11 years ago)
- Location:
- coopr.pyomo/trunk/coopr/pyomo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pyomo/trunk/coopr/pyomo/base/expr.py
r1968 r1975 85 85 # 86 86 def is_constant(self): 87 if self._args is None:88 return True89 87 for arg in self._args: 90 88 if not arg.is_constant(): … … 201 199 self.coef = 1 202 200 Expression.__init__(self,nargs=-1,name='prod') 201 202 def is_constant(self): 203 for arg in self._numerator: 204 if not arg.is_constant(): 205 return False 206 for arg in self._denominator: 207 if not arg.is_constant(): 208 return False 209 return True 203 210 204 211 def invert(self): -
coopr.pyomo/trunk/coopr/pyomo/tests/unit/test_expr.py
r1959 r1975 491 491 def c11_rule(model): 492 492 return model.c == model.A+model.B 493 def c15_rule(model): 494 return model.A <= model.A*model.d 495 def c16_rule(model): 496 return model.A*model.d <= model.B 493 497 494 498 def c12_rule(model): … … 533 537 model.c10 = Constraint(rule=c10_rule) 534 538 model.c11 = Constraint(rule=c11_rule) 539 model.c15 = Constraint(rule=c15_rule) 540 model.c16 = Constraint(rule=c16_rule) 535 541 536 542 model.c12 = Constraint(rule=c12_rule) -
coopr.pyomo/trunk/coopr/pyomo/tests/unit/varpprint.txt
r1959 r1975 40 40 o3 : Size=0 Index= o3_index 41 41 42 1 4Constraint Declarations42 16 Constraint Declarations 43 43 c1 : Size=1 44 44 None … … 71 71 sum( c , -1 * d ) 72 72 Inf 73 c15 : Size=1 74 None 75 identity( A ) 76 prod( num=( A , d ) ) 77 Inf 78 c16 : Size=1 79 None 80 -Inf 81 prod( num=( A , d ) ) 82 identity( B ) 73 83 c2 : Size=1 74 84 None … … 120 130 Inf 121 131 122 2 4 Declarations: a b c d e A B o2 o3_index o3 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11c12 c13 c14132 26 Declarations: a b c d e A B o2 o3_index o3 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c15 c16 c12 c13 c14
Note: See TracChangeset
for help on using the changeset viewer.