mlpack  git-master
frank_wolfe.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_FW_FRANK_WOLFE_HPP
13 #define MLPACK_CORE_OPTIMIZERS_FW_FRANK_WOLFE_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 #include "update_span.hpp"
17 #include "constr_lpball.hpp"
18 
19 namespace mlpack {
20 namespace optimization {
21 
78 template<
79  typename LinearConstrSolverType,
80  typename UpdateRuleType>
82 {
83  public:
96  FrankWolfe(const LinearConstrSolverType linearConstrSolver,
97  const UpdateRuleType updateRule,
98  const size_t maxIterations = 100000,
99  const double tolerance = 1e-10);
100 
117  template<typename FunctionType>
118  double Optimize(FunctionType& function, arma::mat& iterate);
119 
121  const LinearConstrSolverType& LinearConstrSolver()
122  const { return linearConstrSolver; }
124  LinearConstrSolverType& LinearConstrSolver() { return linearConstrSolver; }
125 
127  const UpdateRuleType& UpdateRule() const { return updateRule; }
129  UpdateRuleType& UpdateRule() { return updateRule; }
130 
132  size_t MaxIterations() const { return maxIterations; }
134  size_t& MaxIterations() { return maxIterations; }
135 
137  double Tolerance() const { return tolerance; }
139  double& Tolerance() { return tolerance; }
140 
141  private:
143  LinearConstrSolverType linearConstrSolver;
144 
146  UpdateRuleType updateRule;
147 
149  size_t maxIterations;
150 
152  double tolerance;
153 };
154 
163 
164 } // namespace optimization
165 } // namespace mlpack
166 
167 // Include implementation.
168 #include "frank_wolfe_impl.hpp"
169 
170 #endif
double Optimize(FunctionType &function, arma::mat &iterate)
Optimize the given function using FrankWolfe.
FrankWolfe(const LinearConstrSolverType linearConstrSolver, const UpdateRuleType updateRule, const size_t maxIterations=100000, const double tolerance=1e-10)
Construct the Frank-Wolfe optimizer with the given function and parameters.
.hpp
Definition: add_to_po.hpp:21
const LinearConstrSolverType & LinearConstrSolver() const
Get the linear constrained solver.
double & Tolerance()
Modify the tolerance for termination.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
const UpdateRuleType & UpdateRule() const
Get the update rule.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
UpdateRuleType & UpdateRule()
Modify the update rule.
double Tolerance() const
Get the tolerance for termination.
Frank-Wolfe is a technique to minimize a continuously differentiable convex function over a compact ...
Definition: frank_wolfe.hpp:81
LinearConstrSolverType & LinearConstrSolver()
Modify the linear constrained solver.