xref: /petsc/src/tao/linesearch/impls/armijo/armijo.h (revision f51b456f721b98d642cde39c2fcf9e80a9e252cc)
1a7e14dcfSSatish Balay #ifndef __TAOLINESEARCH_ARMIJO_H
2a7e14dcfSSatish Balay #define __TAOLINESEARCH_ARMIJO_H
3a7e14dcfSSatish Balay 
4a7e14dcfSSatish Balay /* Context for an Armijo (nonmonotone) linesearch for unconstrained
5a7e14dcfSSatish Balay    minimization.
6a7e14dcfSSatish Balay 
7a7e14dcfSSatish Balay    Given a function f, the current iterate x, and a descent direction d:
8a7e14dcfSSatish Balay    Find the smallest i in 0, 1, 2, ..., such that:
9a7e14dcfSSatish Balay 
10a7e14dcfSSatish Balay       f(x + (beta**i)d) <= f(x) + (sigma*beta**i)<grad f(x),d>
11a7e14dcfSSatish Balay 
12a7e14dcfSSatish Balay    The nonmonotone modification of this linesearch replaces the f(x) term
13a7e14dcfSSatish Balay    with a reference value, R, and seeks to find the smallest i such that:
14a7e14dcfSSatish Balay 
15a7e14dcfSSatish Balay       f(x + (beta**i)d) <= R + (sigma*beta**i)<grad f(x),d>
16a7e14dcfSSatish Balay 
17a7e14dcfSSatish Balay    This modification does effect neither the convergence nor rate of
18a7e14dcfSSatish Balay    convergence of an algorithm when R is chosen appropriately.  Essentially,
19a7e14dcfSSatish Balay    R must decrease on average in some sense.  The benefit of a nonmonotone
20a7e14dcfSSatish Balay    linesearch is that local minimizers can be avoided (by allowing increase
21a7e14dcfSSatish Balay    in function value), and typically, fewer iterations are performed in
22a7e14dcfSSatish Balay    the main code.
23a7e14dcfSSatish Balay 
24a7e14dcfSSatish Balay    The reference value is chosen based upon some historical information
25a7e14dcfSSatish Balay    consisting of function values for previous iterates.  The amount of
26a7e14dcfSSatish Balay    historical information used is determined by the memory size where the
27a7e14dcfSSatish Balay    memory is used to store the previous function values.  The memory is
28a7e14dcfSSatish Balay    initialized to alpha*f(x^0) for some alpha >= 1, with alpha=1 signifying
29a7e14dcfSSatish Balay    that we always force decrease from the initial point.
30a7e14dcfSSatish Balay 
31a7e14dcfSSatish Balay    The reference value can be the maximum value in the memory or can be
32a7e14dcfSSatish Balay    chosen to provide some mean descent.  Elements are removed from the
33a7e14dcfSSatish Balay    memory with a replacement policy that either removes the oldest
34a7e14dcfSSatish Balay    value in the memory (FIFO), or the largest value in the memory (MRU).
35a7e14dcfSSatish Balay 
36a7e14dcfSSatish Balay    Additionally, we can add a watchdog strategy to the search, which
37a7e14dcfSSatish Balay    essentially accepts small directions and only checks the nonmonotonic
38a7e14dcfSSatish Balay    descent criteria every m-steps.  This strategy is NOT implemented in
39a7e14dcfSSatish Balay    the code.
40a7e14dcfSSatish Balay 
41a7e14dcfSSatish Balay    Finally, care must be taken when steepest descent directions are used.
42*f51b456fSStefano Zampini    For example, when the Newton direction does not satisfy a sufficient
43a7e14dcfSSatish Balay    descent criteria.  The code will apply the same test regardless of
44a7e14dcfSSatish Balay    the direction.  This type of search may not be appropriate for all
45a7e14dcfSSatish Balay    algorithms.  For example, when a gradient direction is used, we may
46a7e14dcfSSatish Balay    want to revert to the best point found and reset the memory so that
47a7e14dcfSSatish Balay    we stay in an appropriate level set after using a gradient steps.
48a7e14dcfSSatish Balay    This type of search is currently NOT supported by the code.
49a7e14dcfSSatish Balay 
50a7e14dcfSSatish Balay    References:
51a7e14dcfSSatish Balay     Armijo, "Minimization of Functions Having Lipschitz Continuous
52a7e14dcfSSatish Balay       First-Partial Derivatives," Pacific Journal of Mathematics, volume 16,
53a7e14dcfSSatish Balay       pages 1-3, 1966.
54a7e14dcfSSatish Balay     Ferris and Lucidi, "Nonmonotone Stabilization Methods for Nonlinear
55a7e14dcfSSatish Balay       Equations," Journal of Optimization Theory and Applications, volume 81,
56a7e14dcfSSatish Balay       pages 53-71, 1994.
57a7e14dcfSSatish Balay     Grippo, Lampariello, and Lucidi, "A Nonmonotone Line Search Technique
58a7e14dcfSSatish Balay       for Newton's Method," SIAM Journal on Numerical Analysis, volume 23,
59a7e14dcfSSatish Balay       pages 707-716, 1986.
60a7e14dcfSSatish Balay     Grippo, Lampariello, and Lucidi, "A Class of Nonmonotone Stabilization
61a7e14dcfSSatish Balay       Methods in Unconstrained Optimization," Numerische Mathematik, volume 59,
62a7e14dcfSSatish Balay       pages 779-805, 1991. */
63af0996ceSBarry Smith #include <petsc/private/taolinesearchimpl.h>
64a7e14dcfSSatish Balay typedef struct {
65a7e14dcfSSatish Balay   PetscReal *memory;
66a7e14dcfSSatish Balay 
67a7e14dcfSSatish Balay   PetscReal alpha;                      /* Initial reference factor >= 1 */
68a7e14dcfSSatish Balay   PetscReal beta;                       /* Steplength determination < 1 */
69a7e14dcfSSatish Balay   PetscReal beta_inf;           /* Steplength determination < 1 */
70a7e14dcfSSatish Balay   PetscReal sigma;                      /* Acceptance criteria < 1) */
71a7e14dcfSSatish Balay   PetscReal minimumStep;                /* Minimum step size */
72a7e14dcfSSatish Balay   PetscReal lastReference;              /* Reference value of last iteration */
73a7e14dcfSSatish Balay 
74a7e14dcfSSatish Balay   PetscInt memorySize;          /* Number of functions kept in memory */
75a7e14dcfSSatish Balay   PetscInt current;                     /* Current element for FIFO */
76a7e14dcfSSatish Balay   PetscInt referencePolicy;             /* Integer for reference calculation rule */
77a7e14dcfSSatish Balay   PetscInt replacementPolicy;   /* Policy for replacing values in memory */
78a7e14dcfSSatish Balay 
79a7e14dcfSSatish Balay   PetscBool nondescending;
80a7e14dcfSSatish Balay   PetscBool memorySetup;
81a7e14dcfSSatish Balay 
82a7e14dcfSSatish Balay   Vec x;        /* Maintain reference to variable vector to check for changes */
83a7e14dcfSSatish Balay   Vec work;
848caf6e8cSBarry Smith } TaoLineSearch_ARMIJO;
85a7e14dcfSSatish Balay 
86a7e14dcfSSatish Balay #endif
87