mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
aug_lagrangian.hpp
Go to the documentation of this file.
1 
15 #ifndef MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
16 #define MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
17 
18 #include <mlpack/prereqs.hpp>
20 
22 
23 namespace mlpack {
24 namespace optimization {
25 
48 template<typename LagrangianFunction>
50 {
51  public:
55 
63  AugLagrangian(LagrangianFunction& function);
64 
74  L_BFGSType& lbfgs);
75 
86  bool Optimize(arma::mat& coordinates,
87  const size_t maxIterations = 1000);
88 
101  bool Optimize(arma::mat& coordinates,
102  const arma::vec& initLambda,
103  const double initSigma,
104  const size_t maxIterations = 1000);
105 
107  const LagrangianFunction& Function() const { return function; }
109  LagrangianFunction& Function() { return function; }
110 
112  const L_BFGSType& LBFGS() const { return lbfgs; }
114  L_BFGSType& LBFGS() { return lbfgs; }
115 
117  const arma::vec& Lambda() const { return augfunc.Lambda(); }
119  arma::vec& Lambda() { return augfunc.Lambda(); }
120 
122  double Sigma() const { return augfunc.Sigma(); }
124  double& Sigma() { return augfunc.Sigma(); }
125 
126  private:
128  LagrangianFunction& function;
129 
134 
136  L_BFGSType lbfgsInternal;
137 
139  L_BFGSType& lbfgs;
140 };
141 
142 } // namespace optimization
143 } // namespace mlpack
144 
145 #include "aug_lagrangian_impl.hpp"
146 
147 #endif // MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
148 
double & Sigma()
Modify the penalty parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
AugLagrangian(LagrangianFunction &function)
Initialize the Augmented Lagrangian with the default L-BFGS optimizer.
double Sigma() const
Get the penalty parameter.
The AugLagrangian class implements the Augmented Lagrangian method of optimization.
LagrangianFunction & Function()
Modify the LagrangianFunction.
const L_BFGSType & LBFGS() const
Get the L-BFGS object used for the actual optimization.
This is a utility class used by AugLagrangian, meant to wrap a LagrangianFunction into a function usa...
L_BFGSType & LBFGS()
Modify the L-BFGS object used for the actual optimization.
The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function...
Definition: lbfgs.hpp:34
bool Optimize(arma::mat &coordinates, const size_t maxIterations=1000)
Optimize the function.
arma::vec & Lambda()
Modify the Lagrange multipliers (i.e. set them before optimization).
const arma::vec & Lambda() const
Get the Lagrange multipliers.
const LagrangianFunction & Function() const
Get the LagrangianFunction.
L_BFGS< AugLagrangianFunction< LagrangianFunction > > L_BFGSType
Shorthand for the type of the L-BFGS optimizer we&#39;ll be using.