@@ -58,32 +58,27 @@ CURRENT_STRUCT_T(ObjectiveFunctionValue) {
58
58
return *this ;
59
59
}
60
60
};
61
+ // clang-format on
61
62
62
- template <typename T>
63
+ template <typename T>
63
64
struct ObjectiveFunctionValueExtractorImpl {
64
65
using value_t = typename T::value_t ;
65
- static value_t Extract (const T& x) {
66
- return x.value ;
67
- }
66
+ static value_t Extract (const T& x) { return x.value ; }
68
67
};
69
68
70
- template <>
69
+ template <>
71
70
struct ObjectiveFunctionValueExtractorImpl <fncas::double_t > {
72
71
using value_t = fncas::double_t ;
73
- static value_t Extract (fncas::double_t x) {
74
- return x;
75
- }
72
+ static value_t Extract (fncas::double_t x) { return x; }
76
73
};
77
74
78
- template <>
75
+ template <>
79
76
struct ObjectiveFunctionValueExtractorImpl <fncas::term_t > {
80
77
using value_t = fncas::term_t ;
81
- static value_t Extract (fncas::term_t x) {
82
- return x;
83
- }
78
+ static value_t Extract (fncas::term_t x) { return x; }
84
79
};
85
80
86
- template <typename T>
81
+ template <typename T>
87
82
typename ObjectiveFunctionValueExtractorImpl<T>::value_t ExtractValueFromObjectiveFunctionValue (const T& x) {
88
83
return ObjectiveFunctionValueExtractorImpl<T>::Extract (x);
89
84
}
@@ -104,7 +99,7 @@ CURRENT_STRUCT(OptimizationProgress) {
104
99
objective_function_values.push_back (value);
105
100
106
101
// If the user code returns a double, it should always do so.
107
- CURRENT_ASSERT (additional_values.empty ());
102
+ CURRENT_ASSERT (additional_values.empty ());
108
103
}
109
104
110
105
void TrackIteration (const ObjectiveFunctionValue<double >& value) {
@@ -132,7 +127,6 @@ CURRENT_STRUCT(OptimizationResult, ValueAndPoint) {
132
127
CURRENT_FIELD (progress, Optional<OptimizationProgress>);
133
128
CURRENT_CONSTRUCTOR (OptimizationResult)(const ValueAndPoint& p) : SUPER (p) {}
134
129
};
135
- // clang-format on
136
130
137
131
enum class EarlyStoppingCriterion : bool { StopOptimization = false , ContinueOptimization = true };
138
132
0 commit comments