Return codes

The solution status return codes are organized as follows.

  • 0: the final solution satisfies the termination conditions for verifying optimality.
  • -100 to -199: a feasible approximate solution was found.
  • -200 to -299: Knitro terminated at an infeasible point.
  • -300: the problem was determined to be unbounded.
  • -400 to -499: Knitro terminated because it reached a pre-defined limit (-40x codes indicate that a feasible point was found before reaching the limit, while -41x codes indicate that no feasible point was found before reaching the limit).
  • -500 to -599: Knitro terminated with an input error or some non-standard error.

A more detailed description of individual return codes and their corresponding termination messages is provided below.

KN_RC_OPTIMAL_OR_SATISFACTORY
#define KN_RC_OPTIMAL_OR_SATISFACTORY   0   /*-- OPTIMAL CODE */

Locally optimal solution found. Knitro found a locally optimal point which satisfies the stopping criterion. If the problem is convex (for example, a linear program), then this point corresponds to a globally optimal solution.

KN_RC_NEAR_OPT
#define KN_RC_NEAR_OPT                 -100 /*-- FEASIBLE CODES */

Primal feasible solution estimate cannot be improved. It appears to be optimal, but desired accuracy in dual feasibility could not be achieved. No more progress can be made, but the stopping tests are close to being satisfied (within a factor of 100) and so the current approximate solution is believed to be optimal.

KN_RC_FEAS_XTOL
#define KN_RC_FEAS_XTOL                -101

Primal feasible solution; the optimization terminated because the relative change in the solution estimate is less than that specified by the parameter xtol. To try to get more accuracy one may decrease xtol. If xtol is very small already, it is an indication that no more significant progress can be made. It’s possible the approximate feasible solution is optimal, but perhaps the stopping tests cannot be satisfied because of degeneracy, ill-conditioning or bad scaling.

KN_RC_FEAS_NO_IMPROVE
#define KN_RC_FEAS_NO_IMPROVE          -102

Primal feasible solution estimate cannot be improved; desired accuracy in dual feasibility could not be achieved. No further progress can be made. It’s possible the approximate feasible solution is optimal, but perhaps the stopping tests cannot be satisfied because of degeneracy, ill-conditioning or bad scaling.

KN_RC_FEAS_FTOL
#define KN_RC_FEAS_FTOL                -103

Primal feasible solution; the optimization terminated because the relative change in the objective function is less than that specified by the parameter ftol for ftol_iters consecutive iterations. To try to get more accuracy one may decrease ftol and/or increase ftol_iters. If ftol is very small already, it is an indication that no more significant progress can be made. It’s possible the approximate feasible solution is optimal, but perhaps the stopping tests cannot be satisfied because of degeneracy, ill-conditioning or bad scaling.

KN_RC_INFEASIBLE
#define KN_RC_INFEASIBLE               -200 /*-- INFEASIBLE CODES */

Convergence to an infeasible point. Problem may be locally infeasible. If problem is believed to be feasible, try multistart to search for feasible points. The algorithm has converged to an infeasible point from which it cannot further decrease the infeasibility measure. This happens when the problem is infeasible, but may also occur on occasion for feasible problems with nonlinear constraints or badly scaled problems. It is recommended to try various initial points with the multi-start feature. If this occurs for a variety of initial points, it is likely the problem is infeasible.

KN_RC_INFEAS_XTOL
#define KN_RC_INFEAS_XTOL              -201

Terminate at infeasible point because the relative change in the solution estimate is less than that specified by the parameter xtol. To try to find a feasible point one may decrease xtol. If xtol is very small already, it is an indication that no more significant progress can be made. It is recommended to try various initial points with the multi-start feature. If this occurs for a variety of initial points, it is likely the problem is infeasible.

KN_RC_INFEAS_NO_IMPROVE
#define KN_RC_INFEAS_NO_IMPROVE        -202

Current infeasible solution estimate cannot be improved. Problem may be badly scaled or perhaps infeasible. If problem is believed to be feasible, try multistart to search for feasible points. If this occurs for a variety of initial points, it is likely the problem is infeasible.

KN_RC_INFEAS_MULTISTART
#define KN_RC_INFEAS_MULTISTART        -203

Multistart: no primal feasible point found. The multi-start feature was unable to find a feasible point. If the problem is believed to be feasible, then increase the number of initial points tried in the multi-start feature and also perhaps increase the range from which random initial points are chosen.

KN_RC_INFEAS_CON_BOUNDS
#define KN_RC_INFEAS_CON_BOUNDS        -204

The constraint bounds have been determined to be infeasible.

KN_RC_INFEAS_VAR_BOUNDS
#define KN_RC_INFEAS_VAR_BOUNDS        -205

The variable bounds have been determined to be infeasible.

KN_RC_UNBOUNDED
#define KN_RC_UNBOUNDED                -300 /*-- UNBOUNDED CODE */

Problem appears to be unbounded. Iterate is feasible and objective magnitude is greater than objrange. The objective function appears to be decreasing without bound, while satisfying the constraints. If the problem really is bounded, increase the size of the parameter objrange to avoid terminating with this message.

KN_RC_ITER_LIMIT_FEAS
#define KN_RC_ITER_LIMIT_FEAS          -400 /*-- LIMIT EXCEEDED CODES (FEASIBLE) */

The iteration limit was reached before being able to satisfy the required stopping criteria. A feasible point was found. The iteration limit can be increased through the user option maxit.

KN_RC_TIME_LIMIT_FEAS
#define KN_RC_TIME_LIMIT_FEAS          -401

The time limit was reached before being able to satisfy the required stopping criteria. A feasible point was found. The time limit can be increased through the user options maxtime_cpu and maxtime_real.

KN_RC_FEVAL_LIMIT_FEAS
#define KN_RC_FEVAL_LIMIT_FEAS         -402

The function evaluation limit was reached before being able to satisfy the required stopping criteria. A feasible point was found. The function evaluation limit can be increased through the user option maxfevals.

KN_RC_MIP_EXH_FEAS
#define KN_RC_MIP_EXH_FEAS             -403

All nodes have been explored. An integer feasible point was found. The MIP optimality gap has not been reduced below the specified threshold, but there are no more nodes to explore in the branch and bound tree. If the problem is convex, this could occur if the gap tolerance is difficult to meet because of bad scaling or roundoff errors, or there was a failure at one or more of the subproblem nodes. This might also occur if the problem is nonconvex. In this case, Knitro terminates and returns the best integer feasible point found.

KN_RC_MIP_TERM_FEAS
#define KN_RC_MIP_TERM_FEAS            -404

Terminating at first integer feasible point. Knitro has found an integer feasible point and is terminating because the user option mip_terminate is set to “feasible”.

KN_RC_MIP_SOLVE_LIMIT_FEAS
#define KN_RC_MIP_SOLVE_LIMIT_FEAS     -405

Subproblem solve limit reached. An integer feasible point was found. The MIP subproblem solve limit was reached before being able to satisfy the optimality gap tolerance. The subproblem solve limit can be increased through the user option mip_maxsolves.

KN_RC_MIP_NODE_LIMIT_FEAS
#define KN_RC_MIP_NODE_LIMIT_FEAS      -406

Node limit reached. An integer feasible point was found. The MIP node limit was reached before being able to satisfy the optimality gap tolerance. The node limit can be increased through the user option mip_maxnodes.

KN_RC_ITER_LIMIT_INFEAS
#define KN_RC_ITER_LIMIT_INFEAS        -410 /*-- LIMIT EXCEEDED CODES (INFEASIBLE) */

The iteration limit was reached before being able to satisfy the required stopping criteria. No feasible point was found. The iteration limit can be increased through the user option maxit.

KN_RC_TIME_LIMIT_INFEAS
#define KN_RC_TIME_LIMIT_INFEAS        -411

The time limit was reached before being able to satisfy the required stopping criteria. No feasible point was found. The time limit can be increased through the user options maxtime_cpu and maxtime_real.

KN_RC_FEVAL_LIMIT_INFEAS
#define KN_RC_FEVAL_LIMIT_INFEAS       -412

The function evaluation limit was reached before being able to satisfy the required stopping criteria. No feasible point was found. The function evaluation limit can be increased through the user option maxfevals.

KN_RC_MIP_EXH_INFEAS
#define KN_RC_MIP_EXH_INFEAS           -413

All nodes have been explored. No integer feasible point was found. The MIP optimality gap has not been reduced below the specified threshold, but there are no more nodes to explore in the branch and bound tree. If the problem is convex, this could occur if the gap tolerance is difficult to meet because of bad scaling or roundoff errors, or there was a failure at one or more of the subproblem nodes. This might also occur if the problem is nonconvex.

KN_RC_MIP_SOLVE_LIMIT_INFEAS
#define KN_RC_MIP_SOLVE_LIMIT_INFEAS   -415

Subproblem solve limit reached. No integer feasible point was found. The MIP subproblem solve limit was reached before being able to satisfy the optimality gap tolerance. The subproblem solve limit can be increased through the user option mip_maxsolves.

KN_RC_MIP_NODE_LIMIT_INFEAS
#define KN_RC_MIP_NODE_LIMIT_INFEAS    -416

Node limit reached. No integer feasible point was found. The MIP node limit was reached before being able to satisfy the optimality gap tolerance. The node limit can be increased through the user option mip_maxnodes.

KN_RC_CALLBACK_ERR
#define KN_RC_CALLBACK_ERR             -500 /*-- OTHER FAILURES */

Callback function error. This termination value indicates that an error (i.e., negative return value) occurred in a user provided callback routine.

KN_RC_LP_SOLVER_ERR
#define KN_RC_LP_SOLVER_ERR            -501

LP solver error. This termination value indicates that an unrecoverable error occurred in the LP solver used in the active-set algorithm preventing the optimization from continuing.

KN_RC_EVAL_ERR
#define KN_RC_EVAL_ERR                 -502

Evaluation error. This termination value indicates that an evaluation error occurred (e.g., divide by 0, taking the square root of a negative number), preventing the optimization from continuing.

KN_RC_OUT_OF_MEMORY
#define KN_RC_OUT_OF_MEMORY            -503

Not enough memory available to solve problem. This termination value indicates that there was not enough memory available to solve the problem.

KN_RC_USER_TERMINATION
#define KN_RC_USER_TERMINATION         -504

Knitro has been terminated by the user.

Other codes

#define KN_RC_OPEN_FILE_ERR          -505
#define KN_RC_BAD_N_OR_F             -506 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_CONSTRAINT         -507 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_JACOBIAN           -508 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_HESSIAN            -509 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_CON_INDEX          -510 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_JAC_INDEX          -511 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_HESS_INDEX         -512 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_CON_BOUNDS         -513 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_VAR_BOUNDS         -514 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_ILLEGAL_CALL           -515 /*-- KNITRO CALL IS OUT OF SEQUENCE */
#define KN_RC_BAD_KCPTR              -516 /*-- KNITRO PASSED A BAD KC POINTER */
#define KN_RC_NULL_POINTER           -517 /*-- KNITRO PASSED A NULL ARGUMENT */
#define KN_RC_BAD_INIT_VALUE         -518 /*-- APPLICATION INITIAL POINT IS BAD */
#define KN_RC_LICENSE_ERROR          -520 /*-- LICENSE CHECK FAILED */
#define KN_RC_BAD_PARAMINPUT         -521 /*-- INVALID PARAMETER INPUT */
#define KN_RC_LINEAR_SOLVER_ERR      -522 /*-- ERROR IN LINEAR SOLVER */
#define KN_RC_DERIV_CHECK_FAILED     -523 /*-- DERIVATIVE CHECK FAILED */
#define KN_RC_DERIV_CHECK_TERMINATE  -524 /*-- DERIVATIVE CHECK TERMINATE */
#define KN_RC_OVERFLOW_ERR           -525 /*-- INTEGER OVERFLOW ERROR */
#define KN_RC_BAD_SIZE               -526 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_VARIABLE           -527 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_VAR_INDEX          -528 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_OBJECTIVE          -529 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_OBJ_INDEX          -530 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_RESIDUAL           -531 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_BAD_RSD_INDEX          -532 /*-- PROBLEM DEFINITION ERROR */
#define KN_RC_INTERNAL_ERROR         -600 /*-- CONTACT support-knitro@artelys.com */

Termination values in the range -505 to -600 imply some input error or other non-standard failure. If outlev>0, details of this error will be printed to standard output or the file knitro.log depending on the value of outmode.