1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TaoLineSearch/TaoLineSearchApply.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>TaoLineSearchApply</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.7.5 2017-01-01</b></div>
<div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.7.5 v3.7.5 docs/manualpages/TaoLineSearch/TaoLineSearchApply.html "><small>Report Typos and Errors</small></a></div>
<A NAME="TaoLineSearchApply"><H1>TaoLineSearchApply</H1></A>
Performs a line-search in a given step direction. Criteria for acceptable step length depends on the line-search algorithm chosen
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petsctaolinesearch.h"
PetscErrorCode TaoLineSearchApply(TaoLineSearch ls, Vec x, PetscReal *f, Vec g, Vec s, PetscReal *steplength, TaoLineSearchConvergedReason *reason)
</PRE>
Collective on TaoLineSearch
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>ls </B></TD><TD>- the <A HREF="../Tao/Tao.html#Tao">Tao</A> context
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>x </B></TD><TD>- The current solution (on output x contains the new solution determined by the line search)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>f </B></TD><TD>- objective function value at current solution (on output contains the objective function value at new solution)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>g </B></TD><TD>- gradient evaluated at x (on output contains the gradient at new solution)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>s </B></TD><TD>- search direction
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>x </B></TD><TD>- new solution
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>f </B></TD><TD>- objective function value at x
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>g </B></TD><TD>- gradient vector at x
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>steplength </B></TD><TD>- scalar multiplier of s used ( x = x0 + steplength * x )
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>reason </B></TD><TD>- reason why the line-search stopped
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">reason will be set to one of</FONT></H3>
<P>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_FAILED_ASCENT </B></TD><TD>- initial line search step * g is not descent direction
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_FAILED_INFORNAN </B></TD><TD>- function evaluation gives Inf or Nan value
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_FAILED_BADPARAMETER </B></TD><TD>- negative value set as parameter
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_MAXFCN </B></TD><TD>- maximum number of function evaluation reached
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_UPPERBOUND </B></TD><TD>- step is at upper bound
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_LOWERBOUND </B></TD><TD>- step is at lower bound
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_RTOL </B></TD><TD>- range of uncertainty is smaller than given tolerance
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_USER </B></TD><TD>- user can set this reason to stop line search
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_HALTED_OTHER </B></TD><TD>- any other reason
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>TAOLINESEARCH_SUCCESS </B></TD><TD>- successful line search
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Note</FONT></H3>
The algorithm developer must set up the TaoLineSearch with calls to
<A HREF="../TaoLineSearch/TaoLineSearchSetObjectiveRoutine.html#TaoLineSearchSetObjectiveRoutine">TaoLineSearchSetObjectiveRoutine</A>() and <A HREF="../TaoLineSearch/TaoLineSearchSetGradientRoutine.html#TaoLineSearchSetGradientRoutine">TaoLineSearchSetGradientRoutine</A>(), <A HREF="../TaoLineSearch/TaoLineSearchSetObjectiveAndGradientRoutine.html#TaoLineSearchSetObjectiveAndGradientRoutine">TaoLineSearchSetObjectiveAndGradientRoutine</A>(), or <A HREF="../TaoLineSearch/TaoLineSearchUseTaoRoutines.html#TaoLineSearchUseTaoRoutines">TaoLineSearchUseTaoRoutines</A>()
<P>
<H3><FONT COLOR="#CC3333">Note</FONT></H3>
You may or may not need to follow this with a call to
<A HREF="../Tao/TaoAddLineSearchCounts.html#TaoAddLineSearchCounts">TaoAddLineSearchCounts</A>(), depending on whether you want these
evaluations to count toward the total function/gradient evaluations.
<P>
<P>
.seealso: <A HREF="../TaoLineSearch/TaoLineSearchCreate.html#TaoLineSearchCreate">TaoLineSearchCreate</A>(), <A HREF="../TaoLineSearch/TaoLineSearchSetType.html#TaoLineSearchSetType">TaoLineSearchSetType</A>(), <A HREF="../TaoLineSearch/TaoLineSearchSetInitialStepLength.html#TaoLineSearchSetInitialStepLength">TaoLineSearchSetInitialStepLength</A>(), <A HREF="../Tao/TaoAddLineSearchCounts.html#TaoAddLineSearchCounts">TaoAddLineSearchCounts</A>()
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/tao/linesearch/interface/taolinesearch.c.html#TaoLineSearchApply">src/tao/linesearch/interface/taolinesearch.c</A>
<BR><A HREF="./index.html">Index of all TaoLineSearch routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>
|