numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
line_searcher.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
22#include <type_traits> // IWYU pragma: keep
23
29
31
37template <typename T>
38concept line_searcher = requires() {
39 typename T::objective_function_type;
41 typename T::objective_function_type>;
42
43 typename T::variable_type;
44 requires std::is_same_v<typename T::variable_type,
45 typename T::objective_function_type::variable_type>;
46
47 typename T::value_type;
48 requires std::is_same_v<typename T::value_type,
49 typename T::objective_function_type::value_type>;
50
51 requires requires(T& obj, const typename T::variable_type& init_variable) {
52 { obj.init(init_variable) };
53 };
54
55 requires requires(T& obj, const typename T::variable_type& direction) {
56 { obj.search(direction) };
57 };
58
59 requires requires(T& obj) {
60 {
61 obj.obj_fun()
63 };
64
65 requires requires(const T& obj) {
66 {
67 obj.obj_fun()
69 typename T::objective_function_type>;
70
71 {
72 obj.opt_variable()
74
75 {
76 obj.opt_value()
78
79 {
80 obj.gradient()
82
83 {
84 obj.evaluations()
86 };
87};
88
89} // namespace num_collect::opt::concepts
Concept of types implicitly convertible from the given type.
Concept of first-order differentiable objective functions in optimization.
Concept of objects to perform line search in optimization.
Definition of const_reference_of concept.
Definition of differentiable_objective_function concept.
Definition of implicitly_convertible_to concept.
Definition of index_type type.
Definition of reference_of concept.