lrsdp.hpp

Go to the documentation of this file.
00001 
00023 #ifndef __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_HPP
00024 #define __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_HPP
00025 
00026 #include <mlpack/core.hpp>
00027 #include <mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp>
00028 
00029 namespace mlpack {
00030 namespace optimization {
00031 
00032 class LRSDP
00033 {
00034  public:
00044   LRSDP(const size_t numConstraints,
00045         const arma::mat& initialPoint);
00046 
00056   LRSDP(const size_t numConstraints,
00057         const arma::mat& initialPoint,
00058         AugLagrangian<LRSDP>& augLagrangian);
00059 
00066   double Optimize(arma::mat& coordinates);
00067 
00072   double Evaluate(const arma::mat& coordinates) const;
00073 
00078   void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
00079 
00083   double EvaluateConstraint(const size_t index,
00084                             const arma::mat& coordinates) const;
00085 
00090   void GradientConstraint(const size_t index,
00091                           const arma::mat& coordinates,
00092                           arma::mat& gradient) const;
00093 
00095   size_t NumConstraints() const { return b.n_elem; }
00096 
00098   const arma::mat& GetInitialPoint();
00099 
00101   const arma::mat& C() const { return c; }
00103   arma::mat& C() { return c; }
00104 
00106   const std::vector<arma::mat>& A() const { return a; }
00108   std::vector<arma::mat>& A() { return a; }
00109 
00111   const arma::uvec& AModes() const { return aModes; }
00113   arma::uvec& AModes() { return aModes; }
00114 
00116   const arma::vec& B() const { return b; }
00118   arma::vec& B() { return b; }
00119 
00121   const AugLagrangian<LRSDP>& AugLag() const { return augLag; }
00123   AugLagrangian<LRSDP>& AugLag() { return augLag; }
00124 
00125  private:
00126   // Should probably use sparse matrices for some of these.
00127 
00129   arma::mat c;
00131   std::vector<arma::mat> a;
00133   arma::vec b;
00134 
00136   arma::uvec aModes;
00137 
00139   arma::mat initialPoint;
00140 
00142   AugLagrangian<LRSDP> augLagInternal;
00143 
00145   AugLagrangian<LRSDP>& augLag;
00146 };
00147 
00148 }; // namespace optimization
00149 }; // namespace mlpack
00150 
00151 // Include implementation.
00152 #include "lrsdp_impl.hpp"
00153 
00154 #endif

Generated on 13 Aug 2014 for MLPACK by  doxygen 1.6.1