CPXXaddpwl and CPXaddpwl
The routine
CPXXaddpwl/CPXaddpwl
adds a piecewise linear constraint to the specified CPLEX
problem object.
int CPXXaddpwl( CPXCENVptr env, CPXLPptr lp, CPXDIM vary, CPXDIM varx, double preslope, double postslope, CPXDIM nbreaks, double const * breakx, double const * breaky, char const * pwlname)
int CPXaddpwl( CPXCENVptr env, CPXLPptr lp, int vary, int varx, double preslope, double postslope, int nbreaks, double const * breakx, double const * breaky, char const * pwlname)
Description
The routine
CPXXaddpwl/CPXaddpwl
adds a piecewise linear (PWL) constraint to the specified
CPLEX problem object. A PWL constraint defines a piecewise
linear relationship between two variables: y=pwl(x).
You declare a PWL constraint by specifying the index of the 'y' and 'x' variables involved and by providing the breakpoints of the PWL function (specified by the (breakx[i],breaky[i]) coordinate pairs).
Before the first segment of the PWL function, there is a half-line; its slope is specified by preslope.
After the last segment of the the PWL function, there is a half-line; its slope is specified by postslope.
Note that bounds on vary and/or varx may render preslope and/or postslope meaningless (the half line simply may not exist). Even in that case preslope and postslope must be specified, but they can be set to any value.
Two consecutive breakpoints may have the same x-coordinate. In such cases, there is a discontinuity in the PWL function. Three consecutive breakpoints may not have the same x-coordinate.
CPLEX rejects the declaration of a PWL function that lacks
a breakpoint and reports that PWL function as ill-defined with
the error CPXERR_ILL_DEFINED_PWL.
For more general information about piecewise-linear (PWL) constraints, see the topic Using piecewise linear functions in optimization: a transport example in the CPLEX User's Manual.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - vary
- The index of the 'y' variable of the PWL constraint in the lp problem object.
- varx
- The index of the 'x' variable of the PWL constraint in the lp problem object.
- preslope
- The preslope of the PWL function.
- postslope
- The postslope of the PWL function.
- nbreaks
- The number of breakpoints in the PWL function.
- breakx
- The x coordinates of the breakpoints of the PWL function.
- breaky
- The y coordinates of the breakpoints of the PWL function.
- pwlname
- The name of the PWL constraint.