Changeset 9487


Ignore:
Timestamp:
Dec 14, 2014 4:05:47 PM (4 years ago)
Author:
wehart
Message:

Updates to linear transformation logic. Needs to support
generic preprocessing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyomo/trunk/pyomo/core/plugins/transform/linear_dual.py

    r9480 r9487  
    99#  _________________________________________________________________________
    1010
     11from six import iteritems
    1112import itertools
    1213
    1314from pyutilib.misc import Bunch
     15import pyomo.util
    1416from pyomo.util.plugin import alias
    15 from pyomo.core.base import Transformation, Var, Constraint, VarList, ConstraintList, Objective, Set, maximize, minimize, NonNegativeReals, NonPositiveReals, Reals
     17from pyomo.core.base import Transformation, Var, Constraint, VarList, ConstraintList, Objective, Set, maximize, minimize, NonNegativeReals, NonPositiveReals, Reals, Block, Model, ConcreteModel
    1618from pyomo.repn.canonical_repn import generate_canonical_repn
    1719from pyomo.repn.canonical_repn import LinearCanonicalRepn
    1820from pyomo.core.plugins.transform.util import process_canonical_repn
    19 from pyomo.bilevel import SubModel
    2021
    2122import logging
     
    6667        # Execute the preprocessor
    6768        #
    68         instance_.preprocess()
     69        preprocessor = instance.model().config.preprocessor
     70        pyomo.util.PyomoAPIFactory(preprocessor)(instance.model().config, model=instance_)
     71        #instance_.preprocess()
     72        #
    6973        return instance_
    7074
     
    8690            cnames.add((name, data.is_indexed()))
    8791        #
    88         dual = SubModel()
     92        if isinstance(block, Model):
     93            dual = ConcreteModel()
     94        else:
     95            dual = Block()
    8996        for v, is_indexed in vnames:
    9097            if is_indexed:
     
    200207        # Collect bound constraints
    201208        #
    202         for (name, data) in itertools.chain(block.active_components(Var).items(), block._parent().active_components(Var).items()):
     209        for (name, data) in block.active_components(Var).items():
    203210            #
    204211            # Skip fixed variables (in the parent)
Note: See TracChangeset for help on using the changeset viewer.