Try our new documentation site (beta).
GRBModel::setPWLObj()
Set a piecewise-linear objective function for a variable.
The arguments to this method specify a list of points that define a
piecewise-linear objective function for a single variable.
Specifically, the and
arguments give coordinates for the
vertices of the function.
For additional details on piecewise-linear objective functions, refer to this discussion.
void | setPWLObj ( | GRBvar | var, |
int | npoints, | ||
double[] | x, | ||
double[] | y ) |
-
Set the piecewise-linear objective function for a variable.
Arguments:
var: The variable whose objective function is being set.
npoints: Number of points that define the piecewise-linear function.
x: The values for the points that define the piecewise-linear function. Must be in non-decreasing order.
y: The values for the points that define the piecewise-linear function.
![](/wp-content/plugins/hd_documentations/content/images/documentation-ampl-guide.webp)
![](/wp-content/plugins/hd_documentations/content/images/documentation-cloud.webp)
![](/wp-content/plugins/hd_documentations/content/images/documentation-example-tour.webp)
![](/wp-content/plugins/hd_documentations/content/images/documentation-quick-start.webp)
![](/wp-content/plugins/hd_documentations/content/images/documentation-reference-manuals.webp)
![](/wp-content/plugins/hd_documentations/content/images/documentation-remote-services.webp)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-linux.webp)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-mac-osx.webp)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-windows.webp)