MLPACK  1.0.4
aug_lagrangian.hpp
Go to the documentation of this file.
00001 
00025 #ifndef __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
00026 #define __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
00027 
00028 #include <mlpack/core.hpp>
00029 #include <mlpack/core/optimizers/lbfgs/lbfgs.hpp>
00030 
00031 #include "aug_lagrangian_function.hpp"
00032 
00033 namespace mlpack {
00034 namespace optimization {
00035 
00058 template<typename LagrangianFunction>
00059 class AugLagrangian
00060 {
00061  public:
00063   typedef L_BFGS<AugLagrangianFunction<LagrangianFunction> >
00064       L_BFGSType;
00065 
00073   AugLagrangian(LagrangianFunction& function);
00074 
00083   AugLagrangian(AugLagrangianFunction<LagrangianFunction>& augfunc,
00084                 L_BFGSType& lbfgs);
00085 
00096   bool Optimize(arma::mat& coordinates,
00097                 const size_t maxIterations = 1000);
00098 
00111   bool Optimize(arma::mat& coordinates,
00112                 const arma::vec& initLambda,
00113                 const double initSigma,
00114                 const size_t maxIterations = 1000);
00115 
00117   const LagrangianFunction& Function() const { return function; }
00119   LagrangianFunction& Function() { return function; }
00120 
00122   const L_BFGSType& LBFGS() const { return lbfgs; }
00124   L_BFGSType& LBFGS() { return lbfgs; }
00125 
00127   const arma::vec& Lambda() const { return augfunc.Lambda(); }
00129   arma::vec& Lambda() { return augfunc.Lambda(); }
00130 
00132   double Sigma() const { return augfunc.Sigma(); }
00134   double& Sigma() { return augfunc.Sigma(); }
00135 
00136  private:
00138   LagrangianFunction& function;
00139 
00143   AugLagrangianFunction<LagrangianFunction> augfunc;
00144 
00146   L_BFGSType lbfgsInternal;
00147 
00149   L_BFGSType& lbfgs;
00150 };
00151 
00152 }; // namespace optimization
00153 }; // namespace mlpack
00154 
00155 #include "aug_lagrangian_impl.hpp"
00156 
00157 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP