00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef QMCLineSearch_H 00014 #define QMCLineSearch_H 00015 00016 #include <math.h> 00017 00018 #include <vector> 00019 #include "QMCObjectiveFunction.h" 00020 #include "QMCOptimizationAlgorithm.h" 00021 #include "QMCLineSearchStepLengthSelectionAlgorithm.h" 00022 00028 class QMCLineSearch : public QMCOptimizationAlgorithm 00029 { 00030 public: 00041 QMCLineSearch(QMCObjectiveFunction * function, 00042 QMCLineSearchStepLengthSelectionAlgorithm * stepAlg, 00043 int maxSteps, double tol); 00044 00048 virtual ~QMCLineSearch(){}; 00049 00050 Array1D<double> optimize(Array1D<double> & initialGuess, 00051 QMCDerivativeProperties & dp, 00052 double a_diag_factor, 00053 int optStep); 00054 00055 protected: 00056 00060 QMCObjectiveFunction * getObjectiveFunction(); 00061 00062 int dim; 00063 vector<double> f; 00064 vector< Array1D<double> > x; 00065 vector< Array1D<double> > gradient; 00066 vector< Array2D<double> > inverseHessian; 00067 00068 private: 00069 Array1D<double> searchDirection(); 00070 00077 virtual void calculateHessian() = 0; 00078 00087 double stepLength(Array1D<double> & x,Array1D<double> & p, 00088 Array1D<double> & g, double f); 00089 00093 QMCObjectiveFunction *OF; 00094 00098 QMCLineSearchStepLengthSelectionAlgorithm * stepLengthAlg; 00099 00103 double epsilon; 00104 00108 int maximumSteps; 00109 }; 00110 00111 #endif 00112 00113