numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
optimizer_base.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
25
26namespace num_collect::opt {
27
33template <typename Derived>
36protected:
38
39public:
46 : num_collect::base::iterative_solver_base<Derived>(tag) {}
47
53 [[nodiscard]] auto opt_variable() const { return derived().opt_variable(); }
54
60 [[nodiscard]] auto opt_value() const { return derived().opt_value(); }
61
67 [[nodiscard]] auto iterations() const noexcept -> index_type {
68 return derived().iterations();
69 }
70
76 [[nodiscard]] auto evaluations() const noexcept -> index_type {
77 return derived().evaluations();
78 }
79};
80
81} // namespace num_collect::opt
Definition of iterative_solver_base class.
auto derived() noexcept -> Derived &
Access derived object.
Class of tags of logs without memory management.
Base class of implementations of optimization algorithms.
auto evaluations() const noexcept -> index_type
Get the number of function evaluations.
auto opt_value() const
Get current optimal value.
auto opt_variable() const
Get current optimal variable.
optimizer_base(logging::log_tag_view tag)
Constructor.
auto iterations() const noexcept -> index_type
Get the number of iterations.
Definition of index_type type.
Definition of log_tag_view class.
std::ptrdiff_t index_type
Type of indices in this library.
Definition index_type.h:33
Namespace of optimization algorithms.
Namespace of num_collect source codes.