Skip to main content
`Ctrl`+`K`

# TaoConvergedReason

reason a `Tao` optimizer was said to have converged or diverged

## Synopsis

    typedef enum {               /* converged */
      TAO_CONVERGED_GATOL   = 3, /* ||g(X)|| < gatol */
      TAO_CONVERGED_GRTOL   = 4, /* ||g(X)|| / f(X)  < grtol */
      TAO_CONVERGED_GTTOL   = 5, /* ||g(X)|| / ||g(X0)|| < gttol */
      TAO_CONVERGED_STEPTOL = 6, /* step size small */
      TAO_CONVERGED_MINF    = 7, /* F < F_min */
      TAO_CONVERGED_USER    = 8, /* User defined */
      /* diverged */
      TAO_DIVERGED_MAXITS       = -2,
      TAO_DIVERGED_NAN          = -4,
      TAO_DIVERGED_MAXFCN       = -5,
      TAO_DIVERGED_LS_FAILURE   = -6,
      TAO_DIVERGED_TR_REDUCTION = -7,
      TAO_DIVERGED_USER         = -8, /* User defined */
      /* keep going */
      TAO_CONTINUE_ITERATING = 0
    } TaoConvergedReason;

## Values

- `TAO_CONVERGED_GATOL` - \(||g(X)|| < gatol\)

- `TAO_CONVERGED_GRTOL` - \(||g(X)|| / f(X) < grtol\)

- `TAO_CONVERGED_GTTOL` - \(||g(X)|| / ||g(X0)|| < gttol\)

- `TAO_CONVERGED_STEPTOL` - step size smaller than tolerance

- `TAO_CONVERGED_MINF` - \(F < F_min\)

- `TAO_CONVERGED_USER` - the user indicates the optimization has succeeded

- `TAO_DIVERGED_MAXITS` - the maximum number of iterations allowed has been achieved

- `TAO_DIVERGED_NAN` - not a number appeared in the computations

- `TAO_DIVERGED_MAXFCN` - the maximum number of function evaluations has been computed

- `TAO_DIVERGED_LS_FAILURE` - a linesearch failed

- `TAO_DIVERGED_TR_REDUCTION` - trust region failure

- `TAO_DIVERGED_USER` - the user has indicated the optimization has failed

- `TAO_CONTINUE_ITERATING` - the optimization is still running, `TaoSolve()`

where

- X - current solution

- X0 - initial guess

- f(X) - current function value

- f(X) -* true solution (estimated)

- g(X) - current gradient

- its - current iterate number

- maxits - maximum number of iterates

- fevals - number of function evaluations

- max_funcsals - maximum number of function evaluations

## Note

The two most common reasons for divergence are an incorrectly coded or computed gradient or Hessian failure or lack of convergence in the linear system solve (in this case we recommend testing with `-pc_type lu` to eliminate the linear solver as the cause of the problem).

## Developer Note

The names in `KSPConvergedReason`, `SNESConvergedReason`, and `TaoConvergedReason` should be uniformized

## See Also

TAO: Optimization Solvers, `Tao`, `TaoSolve()`, `TaoGetConvergedReason()`, `KSPConvergedReason`, `SNESConvergedReason`

## Level

beginner

## Location

include/petsctao.h

## Examples

src/tao/unconstrained/tutorials/rosenbrock3.c
src/tao/unconstrained/tutorials/rosenbrock2.c

## Examples

src/tao/bound/tutorials/jbearing2.c
src/tao/unconstrained/tutorials/eptorsion2f.F90

## Examples

src/tao/bound/tutorials/jbearing2.c
src/tao/constrained/tutorials/maros.c
src/tao/unconstrained/tutorials/rosenbrock2.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/tao/leastsquares/tutorials/chwirut1f.F90
src/tao/unconstrained/tutorials/rosenbrock3.c
src/tao/unconstrained/tutorials/eptorsion2f.F90

Index of all Tao routines
Table of Contents for all manual pages
Index of all manual pages