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

Description Usage Arguments Details Value See Also Examples

View source: R/kktc.R

Description

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

Usage

1
     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

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.

Value

The output is a list consisting of

gmax

The absolute value of the largest gradient component in magnitude.

evratio

The ratio of the smallest to largest Hessian eigenvalue. Note that this may be negative.

kkt1

A 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.

kkt2

A 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.

See Also

optim

Examples

1
# genrose function code

optfntools documentation built on May 2, 2019, 4:26 p.m.