Changeset 3729


Ignore:
Timestamp:
Feb 28, 2011 1:50:58 PM (9 years ago)
Author:
jwatson
Message:

When computing the canonical expressions for constraints/objectives, the corresponding object was being flagged as "trivial=True" if all indices had constant expressions. However, "trivial=False" was not being asserted in the complementary case, which was causing problems for the Benders example (among others) in which constraints are dynamically added to the model - starting out a trivial (no indices), but becoming trivial when the first constraint is added.

File:
1 edited

Legend:

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

    r3665 r3729  
    7979            if num_nontrivial == 0:
    8080                obj.trivial = True
     81            else:
     82                obj.trivial = False
     83               
    8184        #
    8285        # Constraints
     
    115118            if num_nontrivial == 0:
    116119                constraint.trivial = True
     120            else:
     121                constraint.trivial = False
    117122        #
    118123        # Return modified instance
Note: See TracChangeset for help on using the changeset viewer.