mlpack  1.0.12
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  // convert the obkect into a string
129  std::string ToString() const;
130 
131  private:
133  LagrangianFunction& function;
134 
139 
142 
145 };
146 
147 }; // namespace optimization
148 }; // namespace mlpack
149 
150 #include "aug_lagrangian_impl.hpp"
151 
152 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
153 
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: load.hpp:23
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.
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'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:36
L_BFGS< AugLagrangianFunction< LagrangianFunction > > L_BFGSType
Shorthand for the type of the L-BFGS optimizer we'll be using.
double Sigma() const
Get the penalty parameter.