There are many different ways to define convergence of a solver. The methods TAO uses by default are mentioned in Section . These methods include absolute and relative convergence tolerances as well as a maximum number of iterations of function evaluations. If these choices are not sufficient, the user can even specify a customized test.
Users can set their own customized convergence tests of the form
int conv(TAO_SOLVER tao, void *cctx);The second argument is a pointer to a structure defined by the user. Within this routine, the solver can be queried for the solution vector, gradient vector, or other statistic at the current iteration through routines such as TaoGetSolutionStatus() and TaoGetTolerances().
To use this convergence test within a TAO solver, use
the command
int TaoSetConvergenceTest(TAO_SOLVER solver, int (*conv)(TAO_SOLVER tao, void *cctx), void *cctx);The second argument of this command is the convergence routine, and the final argument of the convergence test routine, cctx, denotes an optional user-defined context for private data. The convergence routine receives the TAO solver and this private data structure. The termination flag can be set using the routine
int TaoSetTerminationReason(TAO_SOLVER , TaoTerminationReason*);