mlpack  1.0.12
lrsdp_function.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
16 #define __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
17 
18 #include <mlpack/core.hpp>
20 
21 namespace mlpack {
22 namespace optimization {
23 
28 {
29  public:
35  LRSDPFunction(const size_t numConstraints,
36  const arma::mat& initialPoint);
37 
42  double Evaluate(const arma::mat& coordinates) const;
43 
48  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
49 
53  double EvaluateConstraint(const size_t index,
54  const arma::mat& coordinates) const;
59  void GradientConstraint(const size_t index,
60  const arma::mat& coordinates,
61  arma::mat& gradient) const;
62 
64  size_t NumConstraints() const { return b.n_elem; }
65 
67  const arma::mat& GetInitialPoint() const { return initialPoint; }
68 
70  const arma::mat& C() const { return c; }
72  arma::mat& C() { return c; }
73 
75  const std::vector<arma::mat>& A() const { return a; }
77  std::vector<arma::mat>& A() { return a; }
78 
80  const arma::uvec& AModes() const { return aModes; }
82  arma::uvec& AModes() { return aModes; }
83 
85  const arma::vec& B() const { return b; }
87  arma::vec& B() { return b; }
88 
90  std::string ToString() const;
91 
92  private:
94  arma::mat c;
96  std::vector<arma::mat> a;
98  arma::vec b;
99 
101  arma::mat initialPoint;
103  arma::uvec aModes;
104 };
105 
106 // Declare specializations in lrsdp_function.cpp.
107 template<>
109  const arma::mat& coordinates) const;
110 
111 template<>
113  const arma::mat& coordinates,
114  arma::mat& gradient) const;
115 
116 };
117 };
118 
119 #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.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
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.