int GRBoptimize ( GRBmodel *model )

Optimize a model. The algorithm used for the optimization depends on the model type (simplex or barrier for a continuous model; branch-and-cut for a MIP model). Upon successful completion, this method will populate the solution related attributes of the model. See the Attributes section for more information on attributes.

Please consult this section for a discussion of some of the practical issues associated with solving a precisely defined mathematical model using finite-precision floating-point arithmetic.

Note that this routine will process all pending model modifications.

Return value:

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


model: The model to optimize. Note that this routine only reports whether the optimization ran into an error. Query the Status attribute to determine the result of the optimization (see the Attributes section for more information on querying attributes).

Example usage:

  error = GRBoptimize(model);