MLPACK  1.0.11
lrsdp_function.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
24 #define __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
25 
26 #include <mlpack/core.hpp>
28 
29 namespace mlpack {
30 namespace optimization {
31 
36 {
37  public:
43  LRSDPFunction(const size_t numConstraints,
44  const arma::mat& initialPoint);
45 
50  double Evaluate(const arma::mat& coordinates) const;
51 
56  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
57 
61  double EvaluateConstraint(const size_t index,
62  const arma::mat& coordinates) const;
67  void GradientConstraint(const size_t index,
68  const arma::mat& coordinates,
69  arma::mat& gradient) const;
70 
72  size_t NumConstraints() const { return b.n_elem; }
73 
75  const arma::mat& GetInitialPoint() const { return initialPoint; }
76 
78  const arma::mat& C() const { return c; }
80  arma::mat& C() { return c; }
81 
83  const std::vector<arma::mat>& A() const { return a; }
85  std::vector<arma::mat>& A() { return a; }
86 
88  const arma::uvec& AModes() const { return aModes; }
90  arma::uvec& AModes() { return aModes; }
91 
93  const arma::vec& B() const { return b; }
95  arma::vec& B() { return b; }
96 
98  std::string ToString() const;
99 
100  private:
102  arma::mat c;
104  std::vector<arma::mat> a;
106  arma::vec b;
107 
109  arma::mat initialPoint;
111  arma::uvec aModes;
112 };
113 
114 // Declare specializations in lrsdp_function.cpp.
115 template<>
117  const arma::mat& coordinates) const;
118 
119 template<>
121  const arma::mat& coordinates,
122  arma::mat& gradient) const;
123 
124 };
125 };
126 
127 #endif // __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
double Evaluate(const arma::mat &coordinates) const
Evaluate the objective function of the Augmented Lagrangian function, which is the standard Lagrangia...
arma::mat initialPoint
Initial point.
arma::mat c
Objective function matrix c.
The objective function that LRSDP is trying to optimize.
const arma::mat & C() const
Return the objective function matrix (C).
arma::mat & C()
Modify the objective function matrix (C).
double EvaluateConstraint(const size_t index, const arma::mat &coordinates) const
Evaluate a particular constraint of the LRSDP at the given coordinates.
void Gradient(const arma::mat &coordinates, arma::mat &gradient) const
Evaluate the gradient of the Augmented Lagrangian function.
size_t NumConstraints() const
Get the number of constraints in the LRSDP.
const arma::vec & B() const
Return the vector of B values.
double Evaluate(const arma::mat &coordinates) const
Evaluate the objective function of the LRSDP (no constraints) at the given coordinates.
std::vector< arma::mat > a
A_i for each constraint.
void GradientConstraint(const size_t index, const arma::mat &coordinates, arma::mat &gradient) const
Evaluate the gradient of a particular constraint of the LRSDP at the given coordinates.
std::vector< arma::mat > & A()
Modify the veector of A matrices (which correspond to the constraints).
arma::vec b
b_i for each constraint.
const std::vector< arma::mat > & A() const
Return the vector of A matrices (which correspond to the constraints).
void Gradient(const arma::mat &coordinates, arma::mat &gradient) const
Evaluate the gradient of the LRSDP (no constraints) at the given coordinates.
arma::uvec & AModes()
Modify the vector of modes for the A matrices.
std::string ToString() const
Return string representation of object.
const arma::mat & GetInitialPoint() const
Get the initial point of the LRSDP.
const arma::uvec & AModes() const
Return the vector of modes for the A matrices.
arma::uvec aModes
1 if entries in matrix, 0 for normal.
arma::vec & B()
Modify the vector of B values.
LRSDPFunction(const size_t numConstraints, const arma::mat &initialPoint)
Construct the LRSDPFunction with the given initial point and number of constraints.