This method builds an instance of piecewise linear function defined everywhere.
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).
Namespace: ILOG.CP
Assembly: oplall (in oplall.dll)
Syntax
| C# |
|---|
public INumToNumSegmentFunction PiecewiseLinearFunction( double[] point, double[] slope, double a, double fa ) |
Parameters
- point
- Type: array<System..::..Double>[]()[][]
- slope
- Type: array<System..::..Double>[]()[][]
- a
- Type: System..::..Double
- fa
- Type: System..::..Double
Remarks
When point[i-1] = point[i], there is a step at the x-coordinate point[i-1] and its height is slope[i] to reach the y-coordinate of point[i].
Example
Examples
IPiecewiseLinearFunction(env, INumArray(env, 2, 10., 20.),
INumArray(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.