Changeset 3037


Ignore:
Timestamp:
Sep 21, 2010 4:42:58 PM (11 years ago)
Author:
jwatson
Message:

Improving the error message output associated with set initialization.

File:
1 edited

Legend:

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

    r2921 r3037  
    181181        if self.domain is not None and element not in self.domain:
    182182           if use_exception:
    183               raise ValueError, "Value "+str(element)+" is not valid for set "+self.name+", because it is not within set "+self.domain.name
     183              raise ValueError, "The value="+str(element)+" is not valid for set="+self.name+", because it is not within the domain="+self.domain.name
    184184           return False
    185185        if self.validate is not None and not self.validate(element,self.model):
    186186           if use_exception:
    187               raise ValueError, "Value "+str(element)+" violates the validation rule of set "+self.name
     187              raise ValueError, "The value="+str(element)+" violates the validation rule of set="+self.name
    188188           return False
    189189        if self.dimen > 1 and type(element) is not tuple:
    190190           if use_exception:
    191               raise ValueError, "Value "+str(element)+" is not a tuple for set "+self.name+", which has dimen "+str(self.dimen)
     191              raise ValueError, "The value="+str(element)+" is not a tuple for set="+self.name+", which has dimen="+str(self.dimen)
    192192           return False
    193193        elif self.dimen == 1 and type(element) is tuple:
    194194           if use_exception:
    195               raise ValueError, "Value "+str(element)+" is a tuple for set "+self.name+", which has dimen "+str(self.dimen)
     195              raise ValueError, "The value="+str(element)+" is a tuple for set="+self.name+", which has dimen="+str(self.dimen)
    196196           return False
    197197        elif type(element) is tuple and len(element) != self.dimen:
    198198           if use_exception:
    199               raise ValueError, "Value "+str(element)+" does not have dimension "+str(self.dimen)+", which is needed for set "+self.name
     199              raise ValueError, "The value="+str(element)+" does not have dimension="+str(self.dimen)+", which is needed for set="+self.name
    200200           return False
    201201        return True
Note: See TracChangeset for help on using the changeset viewer.