8#include <kernel/analytic/common.hpp>
9#include <kernel/util/tiny_algebra.hpp>
28 template<
typename DT_,
typename Function_>
30 struct OptimizationTestTraits;
39 typedef typename FunctionType::template Evaluator<FuncEvalTraits>
EvalType;
100 template<
typename DT_>
101 struct OptimizationTestTraits<DT_, Analytic::Common::BazaraaShettyFunction>
106 typedef typename FunctionType::template Evaluator<FuncEvalTraits>
EvalType;
107 typedef typename EvalType::ValueType
ValueType;
108 typedef typename EvalType::PointType
PointType;
122 min_points.push_back(tmp);
128 XASSERTM((dim >= 0) && (dim <= 2),
"get_domain_bounds defined up to dim = 2, but got "+
stringify(dim));
130 domain(0) = -DT_(0.5);
131 domain(1) = DT_(4.5);
136 return "BazaraaShettyFunction";
140 template<
typename DT_>
141 struct OptimizationTestTraits<DT_, Analytic::Common::GoldsteinPriceFunction>
146 typedef typename FunctionType::template Evaluator<FuncEvalTraits>
EvalType;
147 typedef typename EvalType::ValueType
ValueType;
148 typedef typename EvalType::PointType
PointType;
158 start(1) = DT_(1.17);
168 min_points.push_back(tmp);
172 min_points.push_back(tmp);
176 min_points.push_back(tmp);
180 min_points.push_back(tmp);
186 XASSERTM((dim >= 0) && (dim <= 2),
"get_domain_bounds defined up to dim = 2, but got "+
stringify(dim));
188 domain(0) = -DT_(0.2);
189 domain(1) = DT_(0.2);
194 return "GoldsteinPriceFunction";
198 template<
typename DT_>
199 struct OptimizationTestTraits<DT_, Analytic::Common::HimmelblauFunction>
204 typedef typename FunctionType::template Evaluator<FuncEvalTraits>
EvalType;
205 typedef typename EvalType::ValueType
ValueType;
206 typedef typename EvalType::PointType
PointType;
220 tmp(0) = -DT_(3.77931025337774689189076584129);
221 tmp(1) = -DT_(3.28318599128616941226600051437);
222 min_points.push_back(tmp);
224 tmp(0) = -DT_(2.80511808695274485305357239809);
225 tmp(1) = DT_(3.13131251825057296580430072341);
226 min_points.push_back(tmp);
230 min_points.push_back(tmp);
232 tmp(0) = DT_(3.58442834033049174494433823938);
233 tmp(1) = -DT_(1.84812652696440355353830020904);
234 min_points.push_back(tmp);
240 XASSERTM((dim >= 0) && (dim <= 2),
"get_domain_bounds defined up to dim = 2, but got "+
stringify(dim));
243 domain(1) = DT_(4.5);
248 return "HimmelblauFunction";
252 template<
typename DT_>
253 struct OptimizationTestTraits<DT_, Analytic::Common::RosenbrockFunction>
258 typedef typename FunctionType::template Evaluator<FuncEvalTraits>
EvalType;
259 typedef typename EvalType::ValueType
ValueType;
260 typedef typename EvalType::PointType
PointType;
264 start(0) = -DT_(1.9);
284 domain(0) = -DT_(0.5);
285 domain(1) = DT_(3.5);
288 XABORTM(
"get_domain_bounds defined up to dim = 2, but got "+
stringify(dim));
293 return "RosenbrockFunction";
#define XABORTM(msg)
Abortion macro definition with custom message.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
StaticFunction wrapper class template for Analytic::Function interface.
String class implementation.
Tiny Vector class template.
StaticWrapperFunction< 2, GoldsteinPriceStatic, true, true, true > GoldsteinPriceFunction
*/
StaticWrapperFunction< 2, HimmelblauStatic, true, true, true > HimmelblauFunction
*/
StaticWrapperFunction< 2, RosenbrockStatic, true, true, true > RosenbrockFunction
*/
String stringify(const T_ &item)
Converts an item into a String.
Class holding additional information about certain AnalyticFunction used for optimization tests.
static String name()
Returns the name of the AnalyticFunction.
FunctionType::template Evaluator< FuncEvalTraits > EvalType
Type of the evaluator.
EvalType::ValueType ValueType
Type the function maps to.
static void get_domain_bounds(Tiny::Vector< DT_, 2, sn_ > &domain, int dim)
Gets the domain bounds.
static void get_starting_point(PointType &start)
Gets an initial guess to start from.
Analytic::EvalTraits< DT_, FunctionType > FuncEvalTraits
The evaluation traits for this function.
Function_ FunctionType
The AnalyticFunction i.e. from FEAT::Analytic::Common.
EvalType::PointType PointType
Type the function maps from.
static void get_minimal_points(std::deque< PointType > &min_points)
Gets a list of all minimal points.