Ignore:
Timestamp:
06/08/11 10:51:14 (3 years ago)
Author:
jwatson
Message:

Adding warning when data files are passed into the create() method of a ConcreteModel? instance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/base/PyomoModel.py

    r4119 r4186  
    162162      Please remove references from your code. 
    163163 """ 
     164 
     165        # if you have a concrete model, it's already constructed - passing in a 
     166        # data file is a waste of time. the only reason one would call create() 
     167        # on a concrete instance is to preprocess. 
     168        if (self._defer_construction is False) and (filename is not None): 
     169            name_to_print = self.name 
     170            if name is not None: 
     171                name_to_print = name 
     172            msg = "The filename=%s will not be loaded - supplied as an argument to the create() method of a ConcreteModel instance with name=%s" % (filename, name) 
     173            logger.warning(msg) 
     174             
    164175        if self._defer_construction: 
    165176            instance = self.clone() 
     
    173184        else: 
    174185            instance = self 
     186             
    175187        if preprocess is True: 
    176188 
Note: See TracChangeset for help on using the changeset viewer.