FRAMES NO FRAMES

IloPiecewiseLinear

public IloNumExprArg IloPiecewiseLinear(const IloNumExprArg node, const IloNumArray point, const IloNumArray slope, IloNum a, IloNum fa)
public IloNumExprArg IloPiecewiseLinear(const IloNumExprArg node, IloNum firstSlope, const IloNumArray point, const IloNumArray value, IloNum lastSlope)
Definition file: ilconcert/iloexpression.h
Represents a continuous or discontinuous piecewise linear function.

The function IloPiecewiseLinear creates an expression node to represent a continuous or discontinuous piecewise linear function f of the variable x. The signatures of this overloaded function support two different ways to specify piecewise linear functions. One approach specifies the breakpoints and slopes of the segments of the PWL function. The other approach specifies the breakpoints and function values of the segments. Both approaches can specify either continuous or discontinuous piecewise linear functions.

However, the user must take care with the approach that uses breakpoints and slopes to specify a discontinuous piecewise linear function uniquely. For further explanation about unique specification of discontinuous piecewise linear functions, see the topic Discontinuous piecewise linear functions in the IBM ILOG CPLEX User's Manual.

In the approach using breakpoints and slopes to specify a PWL function, the array point contains the n breakpoints of the function such that point[i-1] <= point[i] for i = 1, . . . , n-1. The array slope contains the n+1 slopes of the n+1 segments of the function. The values a and fa must be coordinates of a point such that fa = f(a).

The argument a cannot be the coordinate of a step. In other words, a must not be the point[i] if point[i] == point[i-1] or if point[i] == point[i+1].

Example
   IloPiecewiseLinear(x, IloNumArray(env, 2, 10., 20.),
                      IloNumArray(env, 3, 0.3, 1., 2.),
                      0, 0);
 

That expression defines a piecewise linear function f having two breakpoints at x = 10 and x = 20, and three segments; their slopes are 0.3, 1, and 2. The first segment has infinite length and ends at the point (x = 10, f(x) = 3) since f(0) = 0. The second segment starts at the point (x = 10, f(x) = 3) and ends at the point (x = 20, f(x) = 13), where the third segment starts.

For the approach that defines a piecewise linear function by breakpoints and values, the array point also contains the n breakpoints of the PWL function. The array value contains the corresponding n values of the function. The argument firstSlope specifies the slope of the segment to the left of the first breakpoint; the argument lastSlope specifies the sleop of the segment to the right of the final breakpoint.

For an example and further explanation of this approach of specification by breakpoint and value, see the topic Discontinuous piecewise linear functions in the IBM ILOG CPLEX User's Manual.