KNITRO

Introduction

Artelys Knitro is a software package for finding local solutions of both continuous (i.e. smooth) optimization problems, with or without constraints, and discrete optimization problems with integer or binary variables. Even though Knitro has been designed for solving large-scale general problems, it is efficient for solving all of the following classes of optimization problems:

  • unconstrained,
  • bound constrained,
  • equality constrained,
  • systems of nonlinear equations,
  • least squares problems,
  • linear programming problems (LPs),
  • quadratic programming problems (QPs),
  • general (inequality) constrained problems,
  • (convex) mixed integer nonlinear programs (MINLP) of moderate size.

The Knitro package provides the following features:

  • Efficient and robust solution of small or large problems,
  • Solvers for both continuous and discrete problems,
  • Derivative-free, 1st derivative and 2nd derivative options,
  • Both interior-point (barrier) and active-set optimizers,
  • Both feasible and infeasible versions,
  • Both iterative and direct approaches for computing steps,

The problems solved by Knitro have the form

\[ \begin{array}{rclr} \mbox{minimize} & \qquad \qquad & f(x) & \qquad \qquad \qquad (1a) \\ \mbox{subject to} & \qquad \qquad & c^L \leq c(x) \leq c^U & \qquad \qquad \qquad (1b) \\ & \qquad \qquad & b^L \leq x \leq b^U, & \qquad \qquad \qquad (1c) \end{array} \]

where the variables \(x\) can be continuous, binary, or integer. This allows many forms of constraints, including bounds on the variables. Knitro requires that the functions \(f(x)\) and \(c(x)\) be smooth functions.

Knitro implements both state-of-the-art interior-point and active-set methods for solving nonlinear optimization problems. In the interior method (also known as a barrier method), the nonlinear programming problem is replaced by a series of barrier sub-problems controlled by a barrier parameter \(\mu\). The algorithm uses trust regions and a merit function to promote convergence. The algorithm performs one or more minimization steps on each barrier problem, then decreases the barrier parameter, and repeats the process until the original problem (1) has been solved to the desired accuracy.

Knitro provides two procedures for computing the steps within the interior point approach. In the version known as Interior/CG each step is computed using a projected conjugate gradient iteration. This approach differs from most interior methods proposed in the literature in that it does not compute each step by solving a linear system involving the KKT (or primal-dual) matrix. Instead, it factors a projection matrix, and uses the conjugate gradient method, to approximately minimize a quadratic model of the barrier problem.

The second procedure for computing the steps, which we call Interior/Direct, always attempts to compute a new iterate by solving the primal-dual KKT matrix using direct linear algebra. In the case when this step cannot be guaranteed to be of good quality, or if negative curvature is detected, then the new iterate is computed by the Interior/CG procedure.

Knitro also implements an active-set sequential linear-quadratic programming (SLQP) algorithm which we call Active. This method is similar in nature to a sequential quadratic programming method but uses linear programming sub-problems to estimate the active-set at each iteration. This active-set code may be preferable when a good initial point can be provided, for example, when solving a sequence of related problems.

For problems with discrete variables, Knitro provides two variants of the branch and bound algorithm. The first is a standard implementation, while the second is specialized for convex, mixed-integer nonlinear problems.

We encourage the user to try all algorithmic options to determine which one is more suitable for the application at hand. For guidance on choosing the best algorithm see section Algorithm Options .

For a detailed description of the algorithm implemented in Interior/CG see [29] and for the global convergence theory see [30] . The method implemented in Interior/Direct is described in [197] . The Active algorithm is described in [32] and the global convergence theory for this algorithm is in [33] . An important component of Knitro is the HSL routine MA27 [91] which is used to solve the linear systems arising at every iteration of the algorithm. In addition, the Active Set algorithm in Knitro may make use of the COIN-OR Clp linear programming solver module. The version used in Knitro may be downloaded from https://www.artelys.com/app/docs/clp/.

Usage

Basic details of solver usage, including how to choose Knitro as the solver and how to use a solver-specific option file, are part of Chapter Solver Usage.

As an NLP solver, Knitro can also be used to solve linear programs (LP), and both convex and nonconvex quadratic programs (QCP).

GAMS Options

The following GAMS options are used by the GAMS/Knitro link:

  • Option ResLim = x;

    Sets the time limit in seconds. If this limit is exceeded the solver will terminate and pass on the current solution to GAMS. See also reslim in section GAMS options .

  • Option SysOut = On;

    This option sends additional Knitro messages to the GAMS listing file. It is useful in case of a solver failure or to get algorithmic details. See also sysout in section GAMS options

  • ModelName.optCA = x;

    Absolute gap stop criterion for a discrete problem. The Knitro option mip_opt_gap_abs takes its default from this value. See also optca in section GAMS options.

  • ModelName.optCR = x;

    Relative gap stop criterion for a discrete problem. The Knitro option mip_opt_gap_rel takes its default from this value. See also optcr in section GAMS options.

Summary of Knitro Options

The Knitro options file knitro.opt allows the user to easily set options controlling Knitro's behavior. Options are set by specifying a keyword and a corresponding value on a line in the knitro.opt file. Lines that begin with a # character are treated as comments and blank lines are ignored. For example, to set the maximum allowable number of iterations to 500, one could use the following options file:

maxit 500

General options

Option Description Default
blasoption Specifies the BLAS/LAPACK function library to use for basic vector and matrix computations 1 or 4 (platform dependent)
blasoptionlib Specifies a dynamic library name that contains object code for BLAS/LAPACK functions
bndrange Specifies max limits on the magnitude of constraint and variable bounds 1e+20
cg_maxit Determines the maximum allowable number of inner conjugate gradient (CG) iterations per Knitro minor iteration -1
cg_pmem Specifies the amount of nonzero elements per column of the Hessian of the Lagrangian which are retained when computing the incomplete Cholesky preconditioner 10
cg_precond Specifies whether an incomplete Cholesky preconditioner is applied during CG iterations in barrier algorithms 0
cg_stoptol Specifies the relative stopping tolerance used for the conjugate gradient (CG) subproblem solves 0.01
convex Declare the problem as convex by setting to 1 or non-convex by setting to 0 -1
cpuplatform This option can be used to specify the target instruction set architecture for the machine on which Knitro is running -1
datacheck Specifies whether to perform more extensive data checks to look for errors in the problem input to Knitro (in particular, this option looks for errors in the sparse Jacobian and/or sparse Hessian structure) 0
delta Specifies the initial trust region radius scaling factor used to determine the initial trust region size 1
eval_cost Use this option to tell Knitro the relative cost of performing callback (e.g. function, gradient and Hessian) evaluations 0
honorbnds Indicates whether or not to enforce satisfaction of simple variable bounds throughout the optimization -1
initpenalty Specifies the initial penalty parameter used in the Knitro merit functions 10
initpt_strategy Specifies the initial point strategy used for the continuous algorithms -1
initvalues Enable use of initial guess for levels and marginals (subsequent solves) 1
initvalues0 Enable use of initial guess for levels and marginals (first solve) 2
linesearch Indicates which linesearch strategy to use for the Interior/Direct or SQP algorithm to search for a new acceptable iterate 0
linesearch_maxtrials Indicates the maximum allowable number of trial points during the linesearch of the Interior/Direct or SQP algorithm before treating the linesearch step as a failure and generating a new step 3
linsolver Indicates which linear solver to use to solve linear systems arising in Knitro algorithms 0
linsolver_maxitref Indicates the maximum allowable number of iterative refinement steps applied when a linear system is solved inside Knitro 2
linsolver_nodeamalg Controls the node amalgamation setting for the MA57, MA86 and MA97 linear solvers 0
linsolver_ooc Indicates whether to use Intel MKL PARDISO out-of-core solve of linear systems when linsolver = mklpardiso 0
linsolver_ordering Sets the ordering method used for the linear system solver -1
linsolver_pivottol Specifies the initial pivot threshold used in factorization routines 1e-08
linsolver_scaling Enables scaling for the linear system solver 0
lp_algorithm Indicates which algorithm to use to solve linear problems (LPs) -1
names Enable to pass variable and equation names to Knitro 0
ncvx_qcqp_init Specifies the initialization strategy used for non-convex QPs and QCQPs -1
nlp_algorithm Indicates which algorithm to use to solve nonlinear problems (e.g. NLPs, QPs, QCQPs) 2
objrange Specifies the extreme limits of the objective function for purposes of determining unboundedness 1e+20
option_file additional option file name - read only by KNITRO solver lib
output_time print output on where time is used 0
qextractalg quadratic extraction algorithm in GAMS interface 0
qextractdenseswitchfactor Sparse/dense factor for quadratic extraction algorithm in GAMS interface 0.008
qextractdenseswitchlog Enables additional information about sparse/dense factor choice in quadratic extraction algorithm in GAMS interface 0
restarts Specifies whether or not to enable automatic restarts in Knitro -1
restarts_maxit When restarts are enabled, this option can be used to specify a maximum number of iterations before enforcing a restart 0
scale Specifies whether to perform problem scaling of the objective function, constraint functions, or possibly variables 1
scale_vars Specifies the strategy for scaling variables 0
soc Specifies whether or not to try second order corrections (SOC) 1
soltype This option specifies the solution returned by Knitro 0
strat_warm_start Specifies whether or not to invoke a warm-start strategy 0
writeprob Writes problem to file (format based on extension)

Derivative options

Option Description Default
bfgs_scaling Specify the initial scaling to use for the BFGS or L-BFGS Hessian approximation 0
findiff_estnoise This option can be used to enable an estimate of the noise in the model when using finite-difference gradients 0
findiff_relstepsize Specifies the relative stepsize used for finite-difference gradients during the optimization 0
gradopt Specifies how to compute the gradients of the objective and constraint functions 1
hessopt Specifies how to compute the (approximate) Hessian of the Lagrangian 0
lmsize Specifies the number of limited memory pairs stored when approximating the Hessian using the limited-memory quasi-Newton BFGS option 8

Termination options

Option Description Default
feastol Specifies the final relative stopping tolerance for the feasibility error -1
feastol_abs Specifies the final absolute stopping tolerance for the feasibility error -1
findiff_terminate This option specifies the termination criteria when using finite-difference gradients 1
fstopval Used to implement a custom stopping condition based on the objective function value maxdouble
ftol The optimization process will terminate if the relative change in the objective function is less than ftol for ftol_iters consecutive feasible iterations 1e-12
ftol_iters The optimization process will terminate if the relative change in the objective function is less than ftol for ftol_iters consecutive feasible iterations 5
infeastol Specifies the (relative) tolerance used for declaring infeasibility of a model 1e-08
infeastol_iters The optimization process will terminate if the relative change in the feasibility error is less than infeastol for infeastol_iters consecutive infeasible iterations 50
maxfevals Specifies the maximum number of function evaluations before termination -1
maxit Specifies the maximum number of iterations before termination GAMS iterlim
maxtime Specifies, in seconds, the maximum allowable real time before termination GAMS reslim
opttol Specifies the final relative stopping tolerance for the KKT (optimality) error -1
opttol_abs Specifies the final absolute stopping tolerance for the KKT (optimality) error -1
xtol The optimization process will terminate if the relative change in all components of the solution point estimate is less than xtol for xtol_iters 1e-12
xtol_iters The optimization process will terminate if the relative change in the solution estimate is less than xtol for xtol_iters consecutive iterations 0

Presolve options

Option Description Default
presolve Determine whether or not to use the Knitro presolver to try to simplify the model by removing variables or constraints 1
presolveop_clique_merging Determine whether or not to enable the Knitro presolve operations that attempts to merge cliques to strengthen the formulation -1
presolveop_probing Determine whether or not to enable the Knitro presolve operations that analyze deductions made by fixing integer variables -1
presolveop_redundant Determine whether or not to enable the Knitro presolve operation to detect and remove redundant constraints 1
presolveop_substitution Determine whether or not to enable the Knitro presolve operation to substitute out variables when possible -1
presolveop_substitution_tol Tolerance for applying a substitution 0.01
presolveop_tighten Determine whether or not to enable the Knitro presolve operation to tighten variable bounds or coefficients -1
presolve_initpt Control whether the Knitro presolver can shift a user-supplied initial point -1
presolve_level Set the level of presolve operations to enable through the Knitro presolver -1
presolve_passes Set a maximum limit on the number of passes through the Knitro presolve operations 10
presolve_tol Determines the tolerance used by the Knitro presolver to remove variables and constraints from the model 1e-06

Barrier options

Option Description Default
bar_conic_enable Enable special treatments for conic constraints when using the Interior/Direct algorithm (has no affect when using the Interior/CG algorithm) -1
bar_directinterval Controls the maximum number of consecutive conjugate gradient (CG) steps before Knitro will try to enforce that a step is taken using direct linear algebra -1
bar_feasible Specifies whether special emphasis is placed on getting and staying feasible in the interior-point algorithms 0
bar_feasmodetol Specifies the tolerance in equation that determines whether Knitro will force subsequent iterates to remain feasible 0.0001
bar_globalize Specifies the globalization strategy used in the interior-point algorithms 2
bar_initmu Specifies the initial value for the barrier parameter \(\mu\) used with the barrier algorithms -1
bar_initpi_mpec Specifies the initial value for the MPEC penalty parameter \(\pi\) used when solving problems with complementarity constraints using the barrier algorithms 0
bar_initpt Indicates initial point strategy for x, slacks and multipliers when using a barrier algorithm 0
bar_linsys Indicates which linear system form is used inside the Interior/Direct algorithm for computing primal-dual steps -1
bar_linsys_storage Indicates how to store in memory the linear systems used inside the Interior/Direct algorithm for computing primal-dual steps -1
bar_maxcorrectors Specifies the maximum number of corrector steps allowed for primal-dual steps -1
bar_maxcrossit Specifies the maximum number of crossover iterations before termination 0
bar_maxmu Specifies the maximum allowable value for the barrier parameter \(\mu\) used with the barrier algorithms 1e+16
bar_maxrefactor Indicates the maximum number of refactorizations of the KKT system per iteration of the Interior/Direct algorithm before reverting to a CG step -1
bar_mpec_heuristic Specifies whether or not to use a heuristic approach when solving MPEC models with the barrier algorithm 0
bar_murule Indicates which strategy to use for modifying the barrier parameter \(mu\) in the barrier algorithms 0
bar_penaltycons Indicates whether a penalty approach is applied to the constraints -1
bar_penaltyrule Indicates which penalty parameter strategy to use for determining whether or not to accept a trial iterate 0
bar_refinement Specifies whether to try to refine the barrier solution for better precision 0
bar_relaxcons Indicates whether a relaxation approach is applied to the constraints 2
bar_slackboundpush Specifies the amount by which the barrier slack variables are initially pushed inside the bounds -1
bar_switchobj Indicates which objective function to use when the barrier algorithms switch to a pure feasibility phase 1
bar_switchrule Indicates whether or not the barrier algorithms will allow switching from an optimality phase to a pure feasibility phase -1
bar_watchdog Specifies whether to enable watchdog heuristic for barrier algorithms 0

Active-set options

Option Description Default
act_lpfeastol Specifies the feasibility tolerance used for linear programming subproblems solved when using the Active Set or SQP algorithms 1e-08
act_lppenalty Indicates whether to use a penalty formulation for linear programming subproblems in the Knitro Active Set or SQP algorithms 1
act_lppresolve Indicates whether to apply a presolve for linear programming subproblems in the Knitro Active Set or SQP algorithms 0
act_parametric Indicates whether to use a parametric approach when solving linear programming (LP) subproblems when using the Knitro Active Set or SQP algorithms 1
act_qpalg Indicates which algorithm to use to solve quadratic programming (QP) subproblems when using the Knitro Active Set or SQP algorithms 0
act_qppenalty Indicates whether to use a penalty formulation for quadratic programming subproblems in the Knitro SQP algorithm