mlpack  master
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 
137 
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 
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.
Definition: binarize.hpp:18
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.
The core includes that mlpack expects; standard C++ includes and Armadillo.
LagrangianFunction & Function()
Modify the LagrangianFunction.
const L_BFGSType & LBFGS() const
Get the L-BFGS object used for the actual optimization.
The AugLagrangian class implements the Augmented Lagrangian method of optimization.
const arma::vec & Lambda() const
Get the Lagrange multipliers.
const LagrangianFunction & Function() const
Get the LagrangianFunction.
double & Sigma()
Modify the penalty parameter.
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...
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:34
L_BFGS< AugLagrangianFunction< LagrangianFunction > > L_BFGSType
Shorthand for the type of the L-BFGS optimizer we&#39;ll be using.
double Sigma() const
Get the penalty parameter.