Changeset 2098
 Timestamp:
 Jan 2, 2010 12:59:45 AM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

coopr.pyomo/trunk/coopr/pyomo/expr/canonical_repn.py
r2057 r2098 9 9 # _________________________________________________________________________ 10 10 11 __all__ = ['generate_canonical_repn' ]11 __all__ = ['generate_canonical_repn', 'as_expr'] 12 12 13 13 import pyutilib.plugin.core 14 from coopr.pyomo.base import IPyomoPresolver, IPyomoPresolveAction 14 from coopr.pyomo.base import IPyomoPresolver, IPyomoPresolveAction, Model 15 15 from coopr.pyomo.base import expr 16 16 from coopr.pyomo.base.var import _VarValue … … 28 28 def as_expr(rep, model, ignore_other=False): 29 29 """ Convert a canonical representation into an expression. """ 30 if isinstance(model, Model): 31 vars = model._var 32 else: 33 vars = model 30 34 expr = 0.0 31 35 for d in rep: … … 41 45 for id in v: 42 46 for i in range(v[id]): 43 e *= model.variable(id)47 e *= vars[id] 44 48 expr += e 45 49 return expr
Note: See TracChangeset
for help on using the changeset viewer.