00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _math_optimize_update_h
00029 #define _math_optimize_update_h
00030
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034
00035 #include <util/state/state.h>
00036 #include <util/class/class.h>
00037 #include <math/scmat/matrix.h>
00038 #include <math/optimize/function.h>
00039 #include <math/optimize/transform.h>
00040
00041 namespace sc {
00042
00043
00044
00045
00046
00047
00048
00054 class HessianUpdate: virtual public SavableState {
00055 protected:
00056 int inverse_hessian_;
00057 public:
00058 HessianUpdate();
00059 HessianUpdate(StateIn&);
00060 HessianUpdate(const Ref<KeyVal>&);
00061 void save_data_state(StateOut&);
00062 virtual ~HessianUpdate();
00063 virtual void update(const RefSymmSCMatrix&hessian,const Ref<Function>&,
00064 const RefSCVector&xnew,const RefSCVector&gnew) = 0;
00065 virtual void set_inverse();
00066 virtual void apply_transform(const Ref<NonlinearTransform>&);
00067 };
00068
00069
00072 class DFPUpdate: public HessianUpdate {
00073 protected:
00074 RefSCVector xprev;
00075 RefSCVector gprev;
00076 public:
00077 DFPUpdate();
00078 DFPUpdate(StateIn&);
00092 DFPUpdate(const Ref<KeyVal>&);
00093 void save_data_state(StateOut&);
00094 ~DFPUpdate();
00095 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&,
00096 const RefSCVector&xnew,const RefSCVector&gnew);
00097 void apply_transform(const Ref<NonlinearTransform>&);
00098 void set_inverse();
00099 };
00100
00104 class BFGSUpdate: public DFPUpdate {
00105 public:
00106 BFGSUpdate();
00107 BFGSUpdate(StateIn&);
00108 BFGSUpdate(const Ref<KeyVal>&);
00109 void save_data_state(StateOut&);
00110 ~BFGSUpdate();
00111 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&,
00112 const RefSCVector&xnew,const RefSCVector&gnew);
00113 };
00114
00119 class PowellUpdate: public HessianUpdate {
00120 protected:
00121 RefSCVector xprev;
00122 RefSCVector gprev;
00123 public:
00124 PowellUpdate();
00125 PowellUpdate(StateIn&);
00126 PowellUpdate(const Ref<KeyVal>&);
00127 void save_data_state(StateOut&);
00128 ~PowellUpdate();
00129 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&func,
00130 const RefSCVector&xnew,const RefSCVector&gnew);
00131 void apply_transform(const Ref<NonlinearTransform>&);
00132 };
00133
00134 }
00135
00136 #endif
00137
00138
00139
00140
00141