mlpack  2.0.1
lrsdp_function.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
16 #define __MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
17 
18 #include <mlpack/core.hpp>
21 
22 namespace mlpack {
23 namespace optimization {
24 
28 template <typename SDPType>
30 {
31  public:
32 
39  LRSDPFunction(const SDPType& sdp,
40  const arma::mat& initialPoint);
41 
53  LRSDPFunction(const size_t numSparseConstraints,
54  const size_t numDenseConstraints,
55  const arma::mat& initialPoint);
56 
61  double Evaluate(const arma::mat& coordinates) const;
62 
67  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
68 
72  double EvaluateConstraint(const size_t index,
73  const arma::mat& coordinates) const;
78  void GradientConstraint(const size_t index,
79  const arma::mat& coordinates,
80  arma::mat& gradient) const;
81 
83  size_t NumConstraints() const { return sdp.NumConstraints(); }
84 
86  const arma::mat& GetInitialPoint() const { return initialPoint; }
87 
89  const SDPType& SDP() const { return sdp; }
90 
92  SDPType& SDP() { return sdp; }
93 
94  private:
95 
97  SDPType sdp;
98 
100  arma::mat initialPoint;
101 };
102 
103 // Declare specializations in lrsdp_function.cpp.
104 template <>
106  const arma::mat& coordinates) const;
107 
108 template <>
110  const arma::mat& coordinates) const;
111 
112 template <>
114  const arma::mat& coordinates,
115  arma::mat& gradient) const;
116 
117 template <>
119  const arma::mat& coordinates,
120  arma::mat& gradient) const;
121 
122 } // namespace optimization
123 } // namespace mlpack
124 
125 // Include implementation
126 #include "lrsdp_function_impl.hpp"
127 
128 #endif // __MLPACK_CORE_OPTIMIZERS_SDP_LRSDP_FUNCTION_HPP
const SDPType & SDP() const
Return the SDP object representing the problem.
void Gradient(const arma::mat &coordinates, arma::mat &gradient) const
Evaluate the gradient of the LRSDP (no constraints) 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.
double Evaluate(const arma::mat &coordinates) const
Evaluate the objective function of the LRSDP (no constraints) at the given coordinates.
Linear algebra utility functions, generally performed on matrices or vectors.
double EvaluateConstraint(const size_t index, const arma::mat &coordinates) const
Evaluate a particular constraint of the LRSDP at the given coordinates.
The objective function that LRSDP is trying to optimize.
SDPType sdp
SDP object representing the problem.
SDPType & SDP()
Modify the SDP object representing the problem.
size_t NumConstraints() const
Get the total number of constraints in the LRSDP.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
arma::mat initialPoint
Initial point.
LRSDPFunction(const SDPType &sdp, const arma::mat &initialPoint)
Construct the LRSDPFunction from the given SDP.
This is a utility class used by AugLagrangian, meant to wrap a LagrangianFunction into a function usa...
const arma::mat & GetInitialPoint() const
Get the initial point of the LRSDP.