13#ifndef OPTIMIST_OPTIMIZER_HH 
   14#define OPTIMIST_OPTIMIZER_HH 
   45    template <
typename Real, Integer N, 
typename DerivedSolver, 
bool ForceEigen = false>
 
   50      static_assert(N != 
static_cast<Integer>(0),
 
   51        "Have you ever heard of a zero-dimensional optimization problem?");
 
   85      std::string 
name()
 const {
return static_cast<const DerivedSolver *
>(
this)->name_impl();}
 
  138        this->evaluate_first_derivative_impl(gradient, x, out);
 
 
  149        this->evaluate_second_derivative_impl(hessian, x, out);
 
 
  161        #define CMD "Optimist::Optimizer::solve(...): " 
  163        static_assert(DerivedSolver::requires_function,
 
  164          CMD "the solver requires the function.");
 
  165        return static_cast<DerivedSolver *
>(
this)->solve_impl(function, x_ini, x_sol);
 
 
  180        #define CMD "Optimist::Optimizer::solve(...): " 
  182        static_assert(DerivedSolver::requires_function,
 
  183          CMD "the solver requires the function.");
 
  184        static_assert(DerivedSolver::requires_first_derivative,
 
  185          CMD "the solver requires the first derivative.");
 
  186        return static_cast<DerivedSolver *
>(
this)->solve_impl(function, gradient, x_ini, x_sol);
 
 
  201        const & x_ini, 
Vector & x_sol)
 
  203        #define CMD "Optimist::Optimizer::solve(...): " 
  205        static_assert(DerivedSolver::requires_function,
 
  206          CMD "the solver requires the function.");
 
  207        static_assert(DerivedSolver::requires_first_derivative,
 
  208          CMD "the solver requires the first derivative.");
 
  209        static_assert(DerivedSolver::requires_second_derivative,
 
  210          CMD "the solver requires the second derivative.");
 
  211        return static_cast<DerivedSolver *
>(
this)->solve_impl(function, gradient, hessian, x_ini, x_sol);
 
 
 
  226    template <
typename Real, 
typename DerivedSolver>
 
  254      std::string 
name()
 const {
return static_cast<const DerivedSolver *
>(
this)->name_impl();}
 
 
 
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:71
 
static constexpr bool requires_first_derivative
Definition Optimizer.hh:236
 
static constexpr bool requires_function
Definition Optimizer.hh:235
 
std::string name() const
Definition Optimizer.hh:254
 
static constexpr bool requires_second_derivative
Definition Optimizer.hh:237
 
static constexpr bool is_rootfinder
Definition Optimizer.hh:232
 
typename SolverBase< Real, 1, 1, DerivedSolver >::FirstDerivativeWrapper FirstDerivativeWrapper
Definition Optimizer.hh:242
 
static constexpr bool is_optimizer
Definition Optimizer.hh:233
 
typename SolverBase< Real, 1, 1, DerivedSolver >::FunctionWrapper FunctionWrapper
Definition Optimizer.hh:241
 
typename SolverBase< Real, 1, 1, DerivedSolver >::SecondDerivativeWrapper SecondDerivativeWrapper
Definition Optimizer.hh:243
 
Optimizer()
Definition Optimizer.hh:248
 
Class container for the multi-dimensional optimizer.
Definition Optimizer.hh:47
 
Optimizer()
Definition Optimizer.hh:79
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::InputType Vector
Definition Optimizer.hh:65
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::FirstDerivativeWrapper GradientWrapper
Definition Optimizer.hh:73
 
static constexpr bool requires_function
Definition Optimizer.hh:58
 
std::string name() const
Definition Optimizer.hh:85
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::SecondDerivativeWrapper HessianWrapper
Definition Optimizer.hh:74
 
static constexpr bool is_rootfinder
Definition Optimizer.hh:55
 
bool solve(FunctionWrapper function, GradientWrapper gradient, Vector const &x_ini, Vector &x_sol)
Definition Optimizer.hh:178
 
Integer max_gradient_evaluations() const
Definition Optimizer.hh:97
 
static constexpr bool requires_first_derivative
Definition Optimizer.hh:59
 
static constexpr bool is_optimizer
Definition Optimizer.hh:56
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::FirstDerivativeType RowVector
Definition Optimizer.hh:68
 
void evaluate_hessian(HessianWrapper hessian, const Vector &x, Matrix &out)
Definition Optimizer.hh:147
 
Integer hessian_evaluations() const
Definition Optimizer.hh:112
 
Integer max_hessian_evaluations() const
Definition Optimizer.hh:118
 
void max_gradient_evaluations(Integer t_gradient_evaluations)
Definition Optimizer.hh:103
 
Integer gradient_evaluations() const
Definition Optimizer.hh:91
 
void max_hessian_evaluations(Integer t_hessian_evaluations)
Definition Optimizer.hh:124
 
static constexpr bool requires_second_derivative
Definition Optimizer.hh:60
 
void evaluate_gradient(GradientWrapper gradient, const Vector &x, Matrix &out)
Definition Optimizer.hh:136
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::SecondDerivativeType Matrix
Definition Optimizer.hh:69
 
bool solve(FunctionWrapper function, GradientWrapper gradient, HessianWrapper hessian, Vector const &x_ini, Vector &x_sol)
Definition Optimizer.hh:200
 
typename SolverBase< Real, N, 1, DerivedSolver, ForceEigen >::FunctionWrapper FunctionWrapper
Definition Optimizer.hh:72
 
bool solve(FunctionWrapper function, Vector const &x_ini, Vector &x_sol)
Definition Optimizer.hh:159
 
std::conditional_t< ForceEigen||(SolInDim > 1)||(SolOutDim > 1), Eigen::Matrix< Real, SolOutDim, SolInDim >, Real > FirstDerivativeType
Definition SolverBase.hh:61
 
Integer max_first_derivative_evaluations() const
Definition SolverBase.hh:273
 
typename std::function< void(const InputType &, SecondDerivativeType &)> SecondDerivativeWrapper
Definition SolverBase.hh:69
 
Integer max_second_derivative_evaluations() const
Definition SolverBase.hh:297
 
typename std::conditional_t< ForceEigen||(SolInDim > 1), Eigen::Vector< Real, SolInDim >, Real > InputType
Definition SolverBase.hh:54
 
Integer second_derivative_evaluations() const
Definition SolverBase.hh:291
 
SolverBase()
Definition SolverBase.hh:107
 
std::conditional_t< ForceEigen||(SolInDim > 1)||(SolOutDim > 1), std::conditional_t< SolInDim==1||SolOutDim==1, Eigen::Matrix< Real, SolInDim, SolInDim >, std::vector< Eigen::Matrix< Real, SolInDim, SolInDim > > >, Real > SecondDerivativeType
Definition SolverBase.hh:62
 
Integer first_derivative_evaluations() const
Definition SolverBase.hh:267
 
typename std::function< void(const InputType &, FirstDerivativeType &)> FirstDerivativeWrapper
Definition SolverBase.hh:68
 
Namespace for the Optimist library.
Definition Optimist.hh:88
 
OPTIMIST_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Optimist.hh:96