Changeset 3274


Ignore:
Timestamp:
Dec 2, 2010 6:32:29 PM (10 years ago)
Author:
jwatson
Message:

Adding example of Piecewise construct using breakpoint and slope rules, as opposed to explicit/direct lists.

Location:
coopr.pyomo/trunk
Files:
2 edited

Legend:

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

    r3268 r3274  
    10291029            return rule
    10301030
    1031 
    10321031        # Bound model.value if domain is bounded
    10331032        if (self._breakvals[0] is not None):
     
    10481047            # constraints We first find the interval containing zero
    10491048
    1050             # Handle the case where the domain has no lower bound
     1049            # Handle the case where the domain has no lower bound.
    10511050            if self._breakvals[0] is None:
    10521051                start = 1
  • coopr.pyomo/trunk/examples/pyomo/piecewise/example5.py

    r3268 r3274  
    1 # a piecewise function constructed by sampling a quadratic.
     1# an example of a piecewise function constructed from breakpoint slopes and rules.
     2# minimum is at (0,0).
    23
    34from coopr.pyomo import *
    4 
    5 # quadratic is defined by a0 + a1*x + a2*a2*x
    6 a0 = 0
    7 a1 = 1
    8 a2 = 2
    9 
    10 num_pieces = 2
    115
    126def compute_breakpoints(m):
Note: See TracChangeset for help on using the changeset viewer.