Skip to main content

piecewise linearisation

Comments

1 comment

  • Daniel Fylstra

    Using Piecewise-Linear Functions

    Many problems involve “stepped” price schedules or quantity discounts, where you might at first expect that a non-smooth function such as CHOOSE or LOOKUP is required to express the relationship.  You might be surprised to learn that you can instead use linear functions and binary integer variables to express the relationship.

    For example, you might be purchasing parts from a vendor who offers discounts at various quantity levels.  The graph below represents such a discount schedule, with three prices and three “breakpoints.”  You have a decision variable x representing the quantity to order.

    piecewise-linear.jpg

    The three prices (slopes of the line segments) are c1, c2 and c3V1 represents a fixed initial cost; V2 and V3 are also constant in the problem and can be computed from:

    V2  = V1  +  c1*B1 - c2*B1
    V3  = V2  +  c2*B2 - c3*B2

    In the model, the variable x is replaced by three variables x1, x2 and x3, representing the quantity ordered or shipped at each possible price.  Also included are three 0-1 or binary integer variables y1, y2 and y3.  Since you want to minimize costs, the objective and constraints are:

    Minimize  V1*y1  +  V2*y2  +  V3*y3  +  c1*x1  +   c2*x2  +   c3*x3
    Subject to  x1  <=  B1*y1,   x2  <=  B2*y2,   x3  <=  B3*y3

    If the cost curve is concave as shown above, this is sufficient; but if the function is non-concave (it may vary up and down), additional “fill constraints” are needed:

    y1  + y2  + y3  <=  1
    x1  <=  B1*y2
    x
    2  <=  B2*y3

    This approach is called a “piecewise-linear” function.  It can be used in place of a CHOOSE or LOOKUP function, and it results in a linear integer model instead of a difficult-to-solve non-smooth model.  Piecewise-linear functions can also be used to approximate a smooth nonlinear function, by using line segments with slopes matching the gradient of the nonlinear function at various intermediate points.

    0

Please sign in to leave a comment.

Powered by Zendesk