Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Optimization Status Codes

Once an optimize call has returned, the Gurobi Optimizer sets the Status attribute of the model to one of several possible values. The attribute takes an integer value, but we recommend that you use one of the predefined status constants to check the status in your program. Each code has a name, and each language requires a prefix on this name to obtain the appropriate constant. You would access status code `OPTIMAL` in the following ways from the available Gurobi interfaces:

Language | Status Code
--- | ---
C | `GRB_OPTIMAL`
C++ | `GRB_OPTIMAL`
Java | `GRB.Status.OPTIMAL`
.NET | `GRB.Status.OPTIMAL`
Python | `GRB.OPTIMAL`

In MATLAB and R, status codes are returned as strings (e.g. `'OPTIMAL'`).

Possible status codes are as follows. Note that for statuses involving limits or other early termination of the optimization, if the feasibility of the reported solution is not evident from the status, you can assess the feasibility by accessing the appropriate solution quality attribute.

Status code | Value | Description
--- | --- | ---
`LOADED` | 1 | Model is loaded, but no solution information is available.
`OPTIMAL` | 2 | Model was solved to optimality (subject to tolerances), and an optimal solution is available.
`INFEASIBLE` | 3 | Model was proven to be infeasible.
`INF_OR_UNBD` | 4 | Model was proven to be either infeasible or unbounded. To obtain a more definitive conclusion, set the DualReductions parameter to 0 and reoptimize.
`UNBOUNDED` | 5 | Model was proven to be unbounded. Important note: an unbounded status indicates the presence of an unbounded ray that allows the objective to improve without limit. It says nothing about whether the model has a feasible solution. If you require information on feasibility, you should set the objective to zero and reoptimize.
`CUTOFF` | 6 | Optimal objective for model was proven to be worse than the value specified in the Cutoff parameter. No solution information is available.
`ITERATION_LIMIT` | 7 | Optimization terminated because the total number of simplex iterations performed exceeded the value specified in the IterationLimit parameter, or because the total number of barrier iterations exceeded the value specified in the BarIterLimit parameter.
`NODE_LIMIT` | 8 | Optimization terminated because the total number of branch-and-cut nodes explored exceeded the value specified in the NodeLimit parameter.
`TIME_LIMIT` | 9 | Optimization terminated because the time expended exceeded the value specified in the TimeLimit parameter.
`SOLUTION_LIMIT` | 10 | Optimization terminated because the number of solutions found reached the value specified in the SolutionLimit parameter.
`INTERRUPTED` | 11 | Optimization was terminated by the user.
`NUMERIC` | 12 | Optimization was terminated due to unrecoverable numerical difficulties.
`SUBOPTIMAL` | 13 | Unable to satisfy optimality tolerances; a sub-optimal solution is available.
`INPROGRESS` | 14 | An asynchronous optimization call was made, but the associated optimization run is not yet complete.
`USER_OBJ_LIMIT` | 15 | User specified an objective limit (a bound on either the best objective or the best bound), and that limit has been reached.
`WORK_LIMIT` | 16 | Optimization terminated because the work expended exceeded the value specified in the WorkLimit parameter.
`MEM_LIMIT` | 17 | Optimization terminated because the total amount of allocated memory exceeded the value specified in the SoftMemLimit parameter.
`LOCALLY_OPTIMAL` | 18 | Model solved to local optimality. A solution satisfying the first-order optimality conditions (subject to tolerances) was found and is available. Note that this is a preview feature.
`LOCALLY_INFEASIBLE` | 19 | Model appears to be locally infeasible. A first-order minimizer of a measure for the constraint violations was found. Note that this is a preview feature.

Help and Feedback

Press `/` or click to search this documentation | Gurobi website | Gurobi community forum
Go to other Gurobi documentation | Gurobi download | Contact support