pwlin
Purpose
Generate a piecewise linear function.
Synopsis
function pwlin(x:mpvar, points:list of real):nlctr
function pwlin(x:mpvar, brks:list of real, slopes:list of real):nlctr
function pwlin(fcts:list of pws):nlctr
Arguments
|
x
|
Input variable of the function
|
|
points
|
List of breakpoints; each point is defined by its coordinates (
i.e. the size of the list must be even)
|
|
brks
|
List of x-values for the breakpoints
|
|
slopes
|
List of slopes to be applied between each breakpoint (there must be 1 more slope than breakpoints)
|
|
fcts
|
List of segments of the function by means of
pws constructs
|
Return value
The piecewise linear expression as an
nlctr entity
Example
The following code extract generates 3 identical piecewise linear functions using the different methods supported by this routine:
pwl1:=pwlin(x,[0.0,0, 1,10, 2,13, 3,15, 4,16])
pwl2:=pwlin(x,[1.0,2,3],[10.0,3,2,1])
pwl3:=pwlin([pws(0,10*x),pws(1,10+3*(x-1)),pws(2,13+2*(x-2)),
pws(3,15+(x-3))])
Further information
1. The first form of the routine expects a list of coordinates: each point is defined by the value for the variable
x and the value of the function on this point. With the second form the list brks specifies the points where the slope of the function changes and the list
slopes gives the actual slopes. The first slope applies for values before the first breakpoint and the last one is for values after the last breakpoint. Note that with this syntax it is assumed that the evaluation of the function is 0 for x=0.
2. Using the last form of the routine makes it possible to describe the function by means of linear expressions. Each element of the list fcts must be a
pws
construct that is composed of a real (the first x-value of the segment) and a linear expression on the input variable (segments must depend on the same input variable).
Module
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
