Changeset 2666


Ignore:
Timestamp:
Jun 16, 2010 11:56:33 AM (11 years ago)
Author:
prsteel
Message:

Changed default behavior of SOSConstraint.

SOSConstraint used to assign a default value of '1' to the 'sos' or
'level' keywords if none were provided by the user. It now raises a
TypeError? asking the user to specify the value.

File:
1 edited

Legend:

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

    r2658 r2666  
    769769            raise TypeError, "Specify only one of 'sos' and 'level' -- " + \
    770770                  "they are equivalent parameters"
    771         sosLevel = kwargs.pop('sos', 1)
     771        sosLevel = kwargs.pop('sos', None)
    772772        sosLevel = kwargs.pop('level', sosLevel)
     773
     774        # Make sure sosLevel has been set
     775        if sosLevel is None:
     776            raise TypeError, "SOSConstraint() requires that either the " + \
     777                  "'sos' or 'level' keyword arguments be set to indicate " + \
     778                  "the type of SOS."
    773779
    774780        # Make sure we have a variable
Note: See TracChangeset for help on using the changeset viewer.