Ignore:
Timestamp:
06/21/10 11:10:25 (4 years ago)
Author:
prsteel
Message:

Fixes test failures; added default behavior to Model objects.

Model objects now respond with 'True' to all inquiries of its
capabilities; this is done to allow users to write solver-agnostic
models with the richest output format.

File:
1 edited

Legend:

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

    r2612 r2699  
    8282        # 
    8383        self.statistics = Container() 
     84 
     85        # We make the default behavior of has_capabilities to lie and return 
     86        # True. We do this to allow the richest output formats when no 
     87        # solver is specified. These capabilities _will_ be overwritten 
     88        # when a solver is specified. 
     89        # 
     90        # We define _tempTrue since using self.has_capability = lambda x: True 
     91        # causes pickling errors. 
     92        self.has_capability = _tempTrue 
    8493 
    8594    def concrete_mode(self): 
     
    564573 
    565574 
     575def _tempTrue(x): 
     576    """ 
     577    Defined to return True to all inquiries 
     578    """ 
     579    return True 
     580 
     581 
    566582class ConcreteModel(Model): 
    567583    """ 
Note: See TracChangeset for help on using the changeset viewer.