gurobi | ( model, params=NULL ) |
This function optimizes the given 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 it will return a list variable containing solution information.
Please consult Variables and Constraints section in the reference manual for a discussion of some of the practical issues associated with solving a precisely defined mathematical model using finite-precision floating-point arithmetic.
Arguments:
model: The model list must contain a valid Gurobi model. See the model argument section for more information.
params: The params list, when provided, contains a list of modified Gurobi parameters. See the params argument section for more information.
Example usage:
result <- gurobi(model, params) if (result$status == 'OPTIMAL') { print(result$objval) print(result$x) } else { cat('Optimization returned status:', formatC(result$status), '\n') }Return value:
The optimization result
The gurobi function returns a list, with the various results of the optimization stored in its named components. The specific results that are available depend on the type of model that was solved, the parameters used, and the status of the optimization. The following is a list of named components that might be available in the returned result. We will discuss the circumstances under which each will be available after presenting the list.
Model named components
Variable named components
Linear constraint named components
Quadratic constraint named components
Solution Pool named components
What is Available When
The status named component will be present in all cases. It indicates whether Gurobi was able to find a proven optimal solution to the model. In cases where a solution to the model was found, optimal or otherwise, the objval and x named components will be present.
For linear and quadratic programs, if a solution is available, then the pi and rc named components will also be present. For models with quadratic constraints, if the parameter qcpdual is set to 1, the named component qcpi will be present. If the final solution is a basic solution (computed by simplex), then vbasis and cbasis will be present. If the model is an unbounded linear program and the InfUnbdInfo parameter is set to 1, the named component unbdray will be present. Finally, if the model is an infeasible linear program and the InfUnbdInfo parameter is set to 1, the named components farkasdual and farkasproof will be set.
For mixed integer problems, no dual information (i.e. pi, slack, rc, vbasis, cbasis, qcslack, qcpi, ubdray or farkasdual) is ever available. When multiple solutions are found, the pool and poolobjbound named components will be present. Depending on the status named component value, the named components nodecount, objbound, objbundc and mipgap will be available.
For continuous and mixed-integer models, under normal execution, the named components runtime, work, itercount and baritercount will be available.