Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
ScalarOptimizer.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco, Mattia Piazza and Enrico Bertolazzi. *
3 * *
4 * The Optimist project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Mattia Piazza Enrico Bertolazzi *
7 * University of Trento University of Trento University of Trento *
8 * davide.stocco@unitn.it mattia.piazza@unitn.it enrico.bertolazzi@unitn.it *
9\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11#pragma once
12
13#ifndef OPTIMIST_SCALAR_OPTIMIZER_HH
14#define OPTIMIST_SCALAR_OPTIMIZER_HH
15
16#include "Solver.hh"
17
18namespace Optimist
19{
20
25 {
26
27 /*\
28 | ____ _ ___ _ _ _
29 | / ___| ___ __ _| | __ _ _ __ / _ \ _ __ | |_(_)_ __ ___ (_)_______ _ __
30 | \___ \ / __/ _` | |/ _` | '__| | | | '_ \| __| | '_ ` _ \| |_ / _ \ '__|
31 | ___) | (_| (_| | | (_| | | | |_| | |_) | |_| | | | | | | |/ / __/ |
32 | |____/ \___\__,_|_|\__,_|_| \___/| .__/ \__|_|_| |_| |_|_/___\___|_|
33 | |_|
34 \*/
35
44 template <typename Real, typename DerivedSolver>
45 class ScalarOptimizer : public Solver<Real, 1, 1, DerivedSolver>
46 {
47 public:
49
50 static constexpr bool is_rootfinder{false};
51 static constexpr bool is_optimizer{true};
52
53 static constexpr bool requires_function{DerivedSolver::requires_function};
54 static constexpr bool requires_first_derivative{DerivedSolver::requires_first_derivative};
55 static constexpr bool requires_second_derivative{DerivedSolver::requires_second_derivative};
56
58
59 using FunctionWrapper = typename Solver<Real, 1, 1, DerivedSolver>::FunctionWrapper;
60 using FirstDerivativeWrapper = typename Solver<Real, 1, 1, DerivedSolver>::FirstDerivativeWrapper;
61 using SecondDerivativeWrapper = typename Solver<Real, 1, 1, DerivedSolver>::SecondDerivativeWrapper;
62
67
72 std::string name() const {return static_cast<const DerivedSolver *>(this)->name_impl();}
73
74 }; // class ScalarOptimizer
75
76 } // namespace ScalarOptimizer
77
78} // namespace Optimist
79
80#endif // OPTIMIST_SCALAR_OPTIMIZER_HH
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:70
Class container for the scalar optimizer.
Definition ScalarOptimizer.hh:46
typename Solver< Real, 1, 1, DerivedSolver >::FirstDerivativeWrapper FirstDerivativeWrapper
Definition ScalarOptimizer.hh:60
static constexpr bool is_optimizer
Definition ScalarOptimizer.hh:51
ScalarOptimizer()
Definition ScalarOptimizer.hh:66
static constexpr bool is_rootfinder
Definition ScalarOptimizer.hh:50
typename Solver< Real, 1, 1, DerivedSolver >::FunctionWrapper FunctionWrapper
Definition ScalarOptimizer.hh:59
static constexpr bool requires_first_derivative
Definition ScalarOptimizer.hh:54
static constexpr bool requires_function
Definition ScalarOptimizer.hh:53
typename Solver< Real, 1, 1, DerivedSolver >::SecondDerivativeWrapper SecondDerivativeWrapper
Definition ScalarOptimizer.hh:61
static constexpr bool requires_second_derivative
Definition ScalarOptimizer.hh:55
std::string name() const
Definition ScalarOptimizer.hh:72
Namespace for the Optimist library.
Definition Optimist.hh:87