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