Changeset 2645


Ignore:
Timestamp:
Jun 7, 2010 10:49:27 AM (11 years ago)
Author:
prsteel
Message:

Added a more useful error message

Message helps catch constraints and objectives that fail to return a
value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/preprocess/identify_vars.py

    r2610 r2645  
    3636    #
    3737    def _identify_variables(self, exp, model):
    38         if exp.fixed_value():
    39             return
     38        try:
     39            if exp.fixed_value():
     40                return
     41        except AttributeError as e:
     42            # Likely caused by a constraint or an objective failing
     43            # to return a value. Let
     44            msg = str(e)
     45            msg += "\n    Do all constraints and objectives return a value?"
     46            raise AttributeError, msg
     47               
    4048        #
    4149        # Product Expressions store stuff differently
Note: See TracChangeset for help on using the changeset viewer.