00001 #ifndef PLAYA_BASIC_LMBFGS_OPT_H 00002 #define PLAYA_BASIC_LMBFGS_OPT_H 00003 00004 00005 #include "PlayaLineSearchBasedOptBase.hpp" 00006 #include <deque> 00007 00008 namespace Playa 00009 { 00015 class BasicLMBFGS : public LineSearchBasedOptBase 00016 { 00017 public: 00019 BasicLMBFGS(const ParameterList& params); 00020 00022 std::string description() const {return "LM-BFGS";} 00023 00025 RCP<DirectionGeneratorBase> makeDirectionGenerator() const ; 00026 00027 private: 00028 int memSize_; 00029 }; 00030 00032 class BasicLMBFGSDirection : public DirectionGeneratorBase 00033 { 00034 public: 00036 BasicLMBFGSDirection(int memSize); 00037 00039 ~BasicLMBFGSDirection() {} 00040 00042 bool generateDirection(const RCP<ObjectiveBase>& obj, 00043 const Vector<double>& xCur, 00044 const Vector<double>& gradCur, 00045 const double& fCur, 00046 Vector<double>& p) ; 00047 00048 private: 00049 int memSize_; 00050 Vector<double> xPrev_; 00051 Vector<double> gradPrev_; 00052 std::deque<Vector<double> > sMem_; 00053 std::deque<Vector<double> > yMem_; 00054 }; 00055 00056 } 00057 00058 #endif