mlpack  2.0.1
aug_lagrangian.hpp
Go to the documentation of this file.
1 
17 #ifndef __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
18 #define __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
19 
20 #include <mlpack/core.hpp>
22 
24 
25 namespace mlpack {
26 namespace optimization {
27 
50 template<typename LagrangianFunction>
52 {
53  public:
57 
65  AugLagrangian(LagrangianFunction& function);
66 
76  L_BFGSType& lbfgs);
77 
88  bool Optimize(arma::mat& coordinates,
89  const size_t maxIterations = 1000);
90 
103  bool Optimize(arma::mat& coordinates,
104  const arma::vec& initLambda,
105  const double initSigma,
106  const size_t maxIterations = 1000);
107 
109  const LagrangianFunction& Function() const { return function; }
111  LagrangianFunction& Function() { return function; }
112 
114  const L_BFGSType& LBFGS() const { return lbfgs; }
116  L_BFGSType& LBFGS() { return lbfgs; }
117 
119  const arma::vec& Lambda() const { return augfunc.Lambda(); }
121  arma::vec& Lambda() { return augfunc.Lambda(); }
122 
124  double Sigma() const { return augfunc.Sigma(); }
126  double& Sigma() { return augfunc.Sigma(); }
127 
128  private:
130  LagrangianFunction& function;
131 
136 
139 
142 };
143 
144 } // namespace optimization
145 } // namespace mlpack
146 
147 #include "aug_lagrangian_impl.hpp"
148 
149 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
150 
L_BFGSType & LBFGS()
Modify the L-BFGS object used for the actual optimization.
arma::vec & Lambda()
Modify the Lagrange multipliers (i.e. set them before optimization).
L_BFGSType & lbfgs
The L-BFGS optimizer that we will use.
Linear algebra utility functions, generally performed on matrices or vectors.
AugLagrangianFunction< LagrangianFunction > augfunc
Internally used AugLagrangianFunction which holds the function we are optimizing. ...
bool Optimize(arma::mat &coordinates, const size_t maxIterations=1000)
Optimize the function.
LagrangianFunction & Function()
Modify the LagrangianFunction.
double Sigma() const
Get the penalty parameter.
The AugLagrangian class implements the Augmented Lagrangian method of optimization.
const L_BFGSType & LBFGS() const
Get the L-BFGS object used for the actual optimization.
double & Sigma()
Modify the penalty parameter.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
const arma::vec & Lambda() const
Get the Lagrange multipliers.
L_BFGSType lbfgsInternal
If the user did not pass an L_BFGS object, we&#39;ll use our own internal one.
This is a utility class used by AugLagrangian, meant to wrap a LagrangianFunction into a function usa...
const LagrangianFunction & Function() const
Get the LagrangianFunction.
AugLagrangian(LagrangianFunction &function)
Initialize the Augmented Lagrangian with the default L-BFGS optimizer.
The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function...
Definition: lbfgs.hpp:36
L_BFGS< AugLagrangianFunction< LagrangianFunction > > L_BFGSType
Shorthand for the type of the L-BFGS optimizer we&#39;ll be using.