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