lrsdp_function.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
14 #define MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
15 
16 #include <mlpack/prereqs.hpp>
19 
20 namespace mlpack {
21 namespace optimization {
22 
35 template <typename SDPType>
37 {
38  public:
45  LRSDPFunction(const SDPType& sdp,
46  const arma::mat& initialPoint);
47 
59  LRSDPFunction(const size_t numSparseConstraints,
60  const size_t numDenseConstraints,
61  const arma::mat& initialPoint);
62 
67  double Evaluate(const arma::mat& coordinates) const;
68 
73  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
74 
78  double EvaluateConstraint(const size_t index,
79  const arma::mat& coordinates) const;
84  void GradientConstraint(const size_t index,
85  const arma::mat& coordinates,
86  arma::mat& gradient) const;
87 
89  size_t NumConstraints() const { return sdp.NumConstraints(); }
90 
92  const arma::mat& GetInitialPoint() const { return initialPoint; }
93 
95  const SDPType& SDP() const { return sdp; }
96 
98  SDPType& SDP() { return sdp; }
99 
101  const arma::mat& RRT() const { return rrt; }
102 
104  arma::mat& RRT() { return rrt; }
105 
106  private:
108  SDPType sdp;
109 
111  arma::mat initialPoint;
112 
114  arma::mat rrt;
115 };
116 
117 // Declare specializations in lrsdp_function.cpp.
118 template <>
120  const arma::mat& coordinates) const;
121 
122 template <>
124  const arma::mat& coordinates) const;
125 
126 template <>
128  const arma::mat& coordinates,
129  arma::mat& gradient) const;
130 
131 template <>
133  const arma::mat& coordinates,
134  arma::mat& gradient) const;
135 
136 } // namespace optimization
137 } // namespace mlpack
138 
139 // Include implementation
140 #include "lrsdp_function_impl.hpp"
141 
142 #endif // MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
LRSDPFunction(const SDPType &sdp, const arma::mat &initialPoint)
Construct the LRSDPFunction from the given SDP.
.hpp
Definition: add_to_po.hpp:21
The objective function that LRSDP is trying to optimize.
void Gradient(const arma::mat &coordinates, arma::mat &gradient) const
Evaluate the gradient of the LRSDP (no constraints) at the given coordinates.
The core includes that mlpack expects; standard C++ includes and Armadillo.
arma::mat & RRT()
Modify R*R^T matrix.
double Evaluate(const arma::mat &coordinates) const
Evaluate the objective function of the LRSDP (no constraints) at the given coordinates.
SDPType & SDP()
Modify the SDP object representing the problem.
size_t NumConstraints() const
Get the total number of constraints in the LRSDP.
const arma::mat & GetInitialPoint() const
Get the initial point of the LRSDP.
This is a utility class used by AugLagrangian, meant to wrap a LagrangianFunction into a function usa...
const arma::mat & RRT() const
Get R*R^T matrix.
double EvaluateConstraint(const size_t index, const arma::mat &coordinates) const
Evaluate a particular constraint of the LRSDP at the given coordinates.
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.
const SDPType & SDP() const
Return the SDP object representing the problem.