| [0b990d] | 1 | //
 | 
|---|
 | 2 | // update.h
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
 | 5 | //
 | 
|---|
 | 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
 | 7 | // Maintainer: LPS
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // This file is part of the SC Toolkit.
 | 
|---|
 | 10 | //
 | 
|---|
 | 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
 | 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
 | 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
 | 14 | // any later version.
 | 
|---|
 | 15 | //
 | 
|---|
 | 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
 | 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 | // GNU Library General Public License for more details.
 | 
|---|
 | 20 | //
 | 
|---|
 | 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
 | 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
 | 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
 | 24 | //
 | 
|---|
 | 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
 | 26 | //
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | #ifndef _math_optimize_update_h
 | 
|---|
 | 29 | #define _math_optimize_update_h
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | #ifdef __GNUC__
 | 
|---|
 | 32 | #pragma interface
 | 
|---|
 | 33 | #endif
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | #include <util/state/state.h>
 | 
|---|
 | 36 | #include <util/class/class.h>
 | 
|---|
 | 37 | #include <math/scmat/matrix.h>
 | 
|---|
 | 38 | #include <math/optimize/function.h>
 | 
|---|
 | 39 | #include <math/optimize/transform.h>
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 | namespace sc {
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 | // //////////////////////////////////////////////////////////////////////
 | 
|---|
 | 44 | //  hessian update classes.  based on the value of inverse_hessian_
 | 
|---|
 | 45 | //  x and g may be reversed (see Schlegel, ab initio Methods in Quantum
 | 
|---|
 | 46 | //  Chemistry I, 1987, p 10
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | /** The HessianUpdate abstract class is used to specify a hessian update
 | 
|---|
 | 50 | scheme.  It is used, for example, by QNewtonOpt objects.  Based on the
 | 
|---|
 | 51 | value of inverse_hessian_ x and g may be reversed (see Schlegel, Ab initio
 | 
|---|
 | 52 | Methods in Quantum Chemistry I, 1987, p 10).
 | 
|---|
 | 53 | */
 | 
|---|
 | 54 | class HessianUpdate: virtual public SavableState {
 | 
|---|
 | 55 |   protected:
 | 
|---|
 | 56 |     int inverse_hessian_;
 | 
|---|
 | 57 |   public:
 | 
|---|
 | 58 |     HessianUpdate();
 | 
|---|
 | 59 |     HessianUpdate(StateIn&);
 | 
|---|
 | 60 |     HessianUpdate(const Ref<KeyVal>&);
 | 
|---|
 | 61 |     void save_data_state(StateOut&);
 | 
|---|
 | 62 |     virtual ~HessianUpdate();
 | 
|---|
 | 63 |     virtual void update(const RefSymmSCMatrix&hessian,const Ref<Function>&,
 | 
|---|
 | 64 |                         const RefSCVector&xnew,const RefSCVector&gnew) = 0;
 | 
|---|
 | 65 |     virtual void set_inverse();
 | 
|---|
 | 66 |     virtual void apply_transform(const Ref<NonlinearTransform>&);
 | 
|---|
 | 67 | };
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 | /** The DFPUpdate class is used to specify a Davidson, Fletcher, and Powell
 | 
|---|
 | 71 | hessian update scheme.  */
 | 
|---|
 | 72 | class DFPUpdate: public HessianUpdate {
 | 
|---|
 | 73 |   protected:
 | 
|---|
 | 74 |     RefSCVector xprev;
 | 
|---|
 | 75 |     RefSCVector gprev;
 | 
|---|
 | 76 |   public:
 | 
|---|
 | 77 |     DFPUpdate();
 | 
|---|
 | 78 |     DFPUpdate(StateIn&);
 | 
|---|
 | 79 |     /** The KeyVal constructor reads the following keywords:
 | 
|---|
 | 80 |     
 | 
|---|
 | 81 |     <dl>
 | 
|---|
 | 82 | 
 | 
|---|
 | 83 |     <dt><tt>xprev</tt><dd> The previous coordinates can be given (but is not
 | 
|---|
 | 84 |     recommended).  The default is none.
 | 
|---|
 | 85 | 
 | 
|---|
 | 86 |     <dt><tt>gprev</tt><dd> The previous gradient can be given (but is not
 | 
|---|
 | 87 |     recommended).  The default is none.
 | 
|---|
 | 88 | 
 | 
|---|
 | 89 |     </dl>
 | 
|---|
 | 90 | 
 | 
|---|
 | 91 |     */
 | 
|---|
 | 92 |     DFPUpdate(const Ref<KeyVal>&);
 | 
|---|
 | 93 |     void save_data_state(StateOut&);
 | 
|---|
 | 94 |     ~DFPUpdate();
 | 
|---|
 | 95 |     void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&,
 | 
|---|
 | 96 |                 const RefSCVector&xnew,const RefSCVector&gnew);
 | 
|---|
 | 97 |     void apply_transform(const Ref<NonlinearTransform>&);
 | 
|---|
 | 98 |     void set_inverse();
 | 
|---|
 | 99 | };
 | 
|---|
 | 100 | 
 | 
|---|
 | 101 | /** The DFPUpdate class is used to specify a Broyden, Fletcher, Goldfarb,
 | 
|---|
 | 102 | and Shanno hessian update scheme.  This hessian update method is the
 | 
|---|
 | 103 | recommended method for use with QNewtonOpt objects.  */
 | 
|---|
 | 104 | class BFGSUpdate: public DFPUpdate {
 | 
|---|
 | 105 |   public:
 | 
|---|
 | 106 |     BFGSUpdate();
 | 
|---|
 | 107 |     BFGSUpdate(StateIn&);
 | 
|---|
 | 108 |     BFGSUpdate(const Ref<KeyVal>&);
 | 
|---|
 | 109 |     void save_data_state(StateOut&);
 | 
|---|
 | 110 |     ~BFGSUpdate();
 | 
|---|
 | 111 |     void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&,
 | 
|---|
 | 112 |                 const RefSCVector&xnew,const RefSCVector&gnew);
 | 
|---|
 | 113 | };
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 | /** The PowellUpdate class is used to specify a Powell hessian update.
 | 
|---|
 | 116 | This hessian update method is the recommended method for use with
 | 
|---|
 | 117 | transition state searches (the EFCOpt class can be used for transition
 | 
|---|
 | 118 | state searches).  */
 | 
|---|
 | 119 | class PowellUpdate: public HessianUpdate {
 | 
|---|
 | 120 |   protected:
 | 
|---|
 | 121 |     RefSCVector xprev;
 | 
|---|
 | 122 |     RefSCVector gprev;
 | 
|---|
 | 123 |   public:
 | 
|---|
 | 124 |     PowellUpdate();
 | 
|---|
 | 125 |     PowellUpdate(StateIn&);
 | 
|---|
 | 126 |     PowellUpdate(const Ref<KeyVal>&);
 | 
|---|
 | 127 |     void save_data_state(StateOut&);
 | 
|---|
 | 128 |     ~PowellUpdate();
 | 
|---|
 | 129 |     void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&func,
 | 
|---|
 | 130 |                 const RefSCVector&xnew,const RefSCVector&gnew);
 | 
|---|
 | 131 |     void apply_transform(const Ref<NonlinearTransform>&);
 | 
|---|
 | 132 | };
 | 
|---|
 | 133 | 
 | 
|---|
 | 134 | }
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 | #endif
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 | // Local Variables:
 | 
|---|
 | 139 | // mode: c++
 | 
|---|
 | 140 | // c-file-style: "CLJ"
 | 
|---|
 | 141 | // End:
 | 
|---|