Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ retry_evaluate()

template<typename Update , typename Proposal , typename Curr , typename Prev , typename Eval , typename P , typename Backoff >
auto stan::math::internal::retry_evaluate ( Update &&  update,
Proposal &&  proposal,
Curr &&  curr,
Prev &&  prev,
Eval eval,
P &&  p,
Backoff &&  backoff 
)
inline

Retry evaluation of a step until it passes a validity check.

The update callable is invoked with (curr, prev, eval, p) and is expected to fill eval (at eval.alpha()) with the objective and directional derivative. If the evaluation is not valid, the backoff callable should shrink eval.alpha() and return whether another retry should be attempted. The validity check can inspect the evaluation and, for non-void updates, the returned status.

Template Parameters
UpdateCallable that performs one evaluation step. Must accept 4 arguments.
ProposalProposed step type passed to update.
CurrCurrent state type passed to update.
PrevPrevious state type passed to update.
EvalEvaluation record containing alpha/obj/dir.
PSearch direction type passed to update.
BackoffCallable that shrinks eval.alpha() and returns a bool.
Parameters
[in]updateEvaluator invoked as update(curr, prev, eval, p).
[in,out]proposalProposed step forwarded to update.
[in]currCurrent state forwarded to update.
[in]prevPrevious state forwarded to update.
[in,out]evalEvaluation record, updated in-place by update.
[in]pSearch direction forwarded to update.
[in]backoffShrinks alpha and returns whether another retry should occur.
Returns
For void updates, returns void. Otherwise returns the value from the first valid evaluation.

Definition at line 579 of file wolfe_line_search.hpp.