petsc-3.7.1 2016-05-15
Report Typos and Errors

# TaoLineSearchApply

Performs a line-search in a given step direction. Criteria for acceptable step length depends on the line-search algorithm chosen

### Synopsis

    #include "petsctaolinesearch.h"
    PetscErrorCode TaoLineSearchApply(TaoLineSearch ls, Vec x, PetscReal *f, Vec g, Vec s, PetscReal *steplength, TaoLineSearchConvergedReason *reason)

Collective on TaoLineSearch Many br

### Input Parameters

| ls | - the Tao context Many br
| x | - The current solution (on output x contains the new solution determined by the line search) Many br
| f | - objective function value at current solution (on output contains the objective function value at new solution) Many br
| g | - gradient evaluated at x (on output contains the gradient at new solution) Many br
| s | - search direction Many br

### Output Parameters

| x | - new solution Many br
| f | - objective function value at x Many br
| g | - gradient vector at x Many br
| steplength | - scalar multiplier of s used ( x = x0 + steplength * x ) Many br
| reason | - reason why the line-search stopped Many br

### reason will be set to one of

| TAOLINESEARCH_FAILED_ASCENT | - initial line search step * g is not descent direction Many br
| TAOLINESEARCH_FAILED_INFORNAN | - function evaluation gives Inf or Nan value Many br
| TAOLINESEARCH_FAILED_BADPARAMETER | - negative value set as parameter Many br
| TAOLINESEARCH_HALTED_MAXFCN | - maximum number of function evaluation reached Many br
| TAOLINESEARCH_HALTED_UPPERBOUND | - step is at upper bound Many br
| TAOLINESEARCH_HALTED_LOWERBOUND | - step is at lower bound Many br
| TAOLINESEARCH_HALTED_RTOL | - range of uncertainty is smaller than given tolerance Many br
| TAOLINESEARCH_HALTED_USER | - user can set this reason to stop line search Many br
| TAOLINESEARCH_HALTED_OTHER | - any other reason Many br
| TAOLINESEARCH_SUCCESS | - successful line search Many br

### Note

The algorithm developer must set up the TaoLineSearch with calls to Many brTaoLineSearchSetObjectiveRoutine() and TaoLineSearchSetGradientRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), or TaoLineSearchUseTaoRoutines() Many br

### Note

You may or may not need to follow this with a call to Many brTaoAddLineSearchCounts(), depending on whether you want these Many brevaluations to count toward the total function/gradient evaluations. Many br

Many br

.seealso: TaoLineSearchCreate(), TaoLineSearchSetType(), TaoLineSearchSetInitialStepLength(), TaoAddLineSearchCounts() Many br

Level:beginner
Location:src/tao/linesearch/interface/taolinesearch.c
Index of all TaoLineSearch routines
Table of Contents for all manual pages
Index of all manual pages