Changeset 2667


Ignore:
Timestamp:
Jun 16, 2010 2:45:58 PM (11 years ago)
Author:
prsteel
Message:

Added empty capabilities dict to 'OptSolver?' base class.

Before, the base class did not define self._capabilities, and so would
throw an error when 'has_capabilities' was called. OptSolver? now
defines an empty self._capabilities container to avoid this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/base/solver.py

    r2657 r2667  
    104104        self.mipgap = None
    105105
     106        # We define no capabilities for the generic solver; base classes must override this
     107        self._capabilities = pyutilib.misc.Options()
     108
    106109    def has_capability(self, cap):
    107110        """
     
    116119                             # False otherwise
    117120        """
    118         try:
    119             # See if self.capabilities has been defined
    120             caps = self._capabilities
    121         except:
    122             raise NotImplementedError, "Generic solver has no capabilities"
    123        
    124121        if not isinstance(cap, str):
    125122            raise TypeError, "Expected argument to be of type '%s', not " + \
Note: See TracChangeset for help on using the changeset viewer.