Try our new documentation site (beta).


GRBgetpwlobj

int GRBgetpwlobj ( GRBmodel *model,
    int var,
    int *npointsP,
    double *x,
    double *y )

Retrieve the piecewise-linear objective function for a variable. The <span>$</span>x<span>$</span> and <span>$</span>y<span>$</span> arguments must be large enough to hold the result. If either are NULL, then npointsP will contain the number of points in the function on return.

Refer to the description of GRBsetpwlobj for additional information on what the values in <span>$</span>x<span>$</span> and <span>$</span>y<span>$</span> mean.

Return value:

A non-zero return value indicates that a problem occurred while retrieving the piecewise-linear objective function. Refer to the Error Code table for a list of possible return values. Details on the error can be obtained by calling GRBgeterrormsg.

Arguments:

model: The model from which the piecewise-linear objective function is being retrieved.

var: The variable whose objective function is being retrieved.

npointsP: The number of points that define the piecewise-linear function.

x: The <span>$</span>x<span>$</span> values for the points that define the piecewise-linear function. These will always be in non-decreasing order.

y: The <span>$</span>y<span>$</span> values for the points that define the piecewise-linear function.

Example usage:

  double *x;
  double *y;

  error = GRBgetpwlobj(model, var, &npoints, NULL, NULL);
  /* ...allocate x and y to hold 'npoints' values... */
  error = GRBgetpwlobj(model, var, &npoints, x, y);

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization