MLPACK  1.0.11
aug_lagrangian.hpp
Go to the documentation of this file.
1 
25 #ifndef __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
26 #define __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
27 
28 #include <mlpack/core.hpp>
30 
32 
33 namespace mlpack {
34 namespace optimization {
35 
58 template<typename LagrangianFunction>
60 {
61  public:
65 
73  AugLagrangian(LagrangianFunction& function);
74 
84  L_BFGSType& lbfgs);
85 
96  bool Optimize(arma::mat& coordinates,
97  const size_t maxIterations = 1000);
98 
111  bool Optimize(arma::mat& coordinates,
112  const arma::vec& initLambda,
113  const double initSigma,
114  const size_t maxIterations = 1000);
115 
117  const LagrangianFunction& Function() const { return function; }
119  LagrangianFunction& Function() { return function; }
120 
122  const L_BFGSType& LBFGS() const { return lbfgs; }
124  L_BFGSType& LBFGS() { return lbfgs; }
125 
127  const arma::vec& Lambda() const { return augfunc.Lambda(); }
129  arma::vec& Lambda() { return augfunc.Lambda(); }
130 
132  double Sigma() const { return augfunc.Sigma(); }
134  double& Sigma() { return augfunc.Sigma(); }
135 
136  // convert the obkect into a string
137  std::string ToString() const;
138 
139  private:
141  LagrangianFunction& function;
142 
147 
150 
153 };
154 
155 }; // namespace optimization
156 }; // namespace mlpack
157 
158 #include "aug_lagrangian_impl.hpp"
159 
160 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
161 
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.
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:44
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.