Learn R Programming

optextras (version 2013-10.27)

kktc: Check Kuhn Karush Tucker conditions for a supposed function minimum

Description

Provide a check on Kuhn-Karush-Tucker conditions based on quantities already computed. Some of these used only for reporting.

Usage

kktc(par, fval, ngr, nHes, nbm, maxfn=FALSE, control=list() )

Arguments

par
A vector of values for the parameters which are supposedly optimal.
fval
Function value at parameters par.
ngr
Gradient (possibly estimated) of the function at par.
nHes
Matrix that is supposedly the Hessian at par.
nbm
Number of active masks or bounds on par.
maxfn
Logical TRUE if function is being maximized. Default FALSE.
control
A list of controls for the function, made up of the following items
kkt2tol
A tolerance used for the KKT Hessian check.
ktrace
A logical flag that, if TRUE, displays intermediate information on the progress of the function. Default is FALSE.

Value

  • The output is a list consisting of
  • gmaxThe absolute value of the largest gradient component in magnitude.
  • evratioThe ratio of the smallest to largest Hessian eigenvalue. Note that this may be negative.
  • kkt1A logical value that is TRUE if we consider the first (i.e., gradient) KKT condition to be satisfied. WARNING: The decision is dependent on tolerances and scaling that may be inappropriate for some problems.
  • kkt2A logical value that is TRUE if we consider the second (i.e., positive definite Hessian) KKT condition to be satisfied. WARNING: The decision is dependent on tolerances and scaling that may be inappropriate for some problems.

encoding

UTF-8

concept

  • minimization
  • maximization

Details

At the moment, kktc does NOT handle box constraints or masks in its tests, except to ignore the dimensions for masks (not active bounds). The present code was developed by lifting it from optimx so that KKT checks could be added to other optimization routines. Note that we IGNORE the sign of the gradient in the case that the objective is being maximized. We do account for the sign of the Hessian for curvature however.

See Also

optim

Examples

Run this code
# genrose function code

Run the code above in your browser using DataLab