Syntax of Piecewise Linear Functions |
INDEX PREVIOUS NEXT |
To define a piecewise linear function in Concert Technology, you need these components:
In other words, for a piecewise linear function of n
breakpoints, you need to know n+1
slopes.
Typically, the breakpoints of a piecewise linear function are specified as an array of numeric values. For example, the breakpoints of the function f(x)
as it appears in Figure 18.1 are specified in this way, where the first argument, env
, specifies the environment, the second argument specifies the number of breakpoints under consideration, and the remaining arguments specify the x-coordinate of the breakpoints:
IloNumArray (env, 3, 4., 5., 7.) |
The slopes of its segments are indicated as an array of numeric values as well. For example, the slopes of f(x)
are specified in this way, where the first argument again specifies the environment, the second argument specifies the number of slopes given, and the remaining arguments specify the slope of the segments:
IloNumArray (env, 4, -0.5, 1., -1., 2.) |
The geometric coordinates of at least one point of the function, (x, f(x))
must also be specified; for example, (4, 2)
. Then in Concert Technology, those elements are brought together in an instance of the class IloPiecewiseLinear
in this way:
IloPiecewiseLinear(x, IloNumArray(env, 3, 4., 5., 7.), IloNumArray(env, 4, -0.5, 1., -1., 2.), 4, 2) |
Another way to specify a piecewise linear function is to give the slope of the first segment, two arrays for the coordinates of the breakpoints, and the slope of the last segment. In this approach, the example f(x)
from Figure 18.1 looks like this:
IloPiecewiseLinear(x, -0.5, IloNumArray(env, 3, 4., 5., 7.), IloNumArray(env, 3, 2., 3., 1.), 2); |
Copyright © 1987-2007 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |