13#ifndef OPTIMIST_TESTSET_SCHAFFER2_HH
14#define OPTIMIST_TESTSET_SCHAFFER2_HH
35 template <
typename Real>
51 for (Real x{-100}; x < 100 + EPSILON; x += 100/25.0) {
52 for (Real y{-100}; y < 100 + EPSILON; y += 100/25.0) {
73 Real xx_0_m_xx_1{xx_0 - xx_1};
74 Real xx_0_p_xx_1{xx_0 + xx_1};
75 out = 0.5 + (std::sin(xx_0_m_xx_1)*std::sin(xx_0_m_xx_1) - 0.5) /
76 ((1.0 + 0.001*(xx_0_p_xx_1))*(1.0 + 0.001*(xx_0_p_xx_1)));
88 Real xx_0_m_xx_1{xx_0 - xx_1};
89 Real xx_0_p_xx_1{xx_0 + xx_1};
90 Real tmp{1.0 + 0.001*(xx_0_p_xx_1)};
91 Real tmp2{tmp*tmp}, tmp3{tmp2*tmp};
92 out(0) = 2.0*x(0)*std::sin(xx_0_m_xx_1) / tmp2 -
93 2.0*0.001*x(0)*std::cos(xx_0_m_xx_1) / tmp3;
94 out(1) = -2.0*x(1)*std::sin(xx_0_m_xx_1) / tmp2 +
95 2.0*0.001*x(1)*std::cos(xx_0_m_xx_1) / tmp3;
105 Real xx_0{x(0)*x(0)};
106 Real xx_1{x(1)*x(1)};
107 Real xx_0_m_xx_1{xx_0 - xx_1};
108 Real xx_0_p_xx_1{xx_0 + xx_1};
109 Real tmp{1.0 + 0.001*(xx_0_p_xx_1)};
110 Real tmp2{tmp*tmp}, tmp3{tmp2*tmp}, tmp4{tmp2*tmp2};
111 out(0, 0) = 2.0*std::sin(xx_0_m_xx_1) / tmp2 -
112 4.0*x(0)*x(0)*std::sin(xx_0_m_xx_1) / tmp3 +
113 6.0*0.001*x(0)*x(0)*std::cos(xx_0_m_xx_1) / tmp4;
114 out(0, 1) = -2.0*x(0)*x(1)*std::sin(xx_0_m_xx_1) / tmp3 +
115 6.0*0.001*x(0)*x(1)*std::cos(xx_0_m_xx_1) / tmp4;
116 out(1, 0) = out(0, 1);
117 out(1, 1) = 2.0*std::sin(xx_0_m_xx_1) / tmp2 -
118 4.0*x(1)*x(1)*std::sin(xx_0_m_xx_1) / tmp3 +
119 6.0*0.001*x(1)*x(1)*std::cos(xx_0_m_xx_1) / tmp4;
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:70
std::vector< InputType > m_guesses
Definition Function.hh:63
std::vector< InputType > m_solutions
Definition Function.hh:62
Function()
Definition Function.hh:203
void first_derivative_impl(const Vector &x, RowVector &out) const
Definition Schaffer2.hh:84
typename Function< Real, 2, 1, Schaffer2< Real > >::RowVector RowVector
Definition Schaffer2.hh:40
void evaluate_impl(const Vector &x, Real &out) const
Definition Schaffer2.hh:69
void second_derivative_impl(const Vector &x, Matrix &out) const
Definition Schaffer2.hh:103
std::string name_impl() const
Definition Schaffer2.hh:62
typename Function< Real, 2, 1, Schaffer2< Real > >::Vector Vector
Definition Schaffer2.hh:39
typename Function< Real, 2, 1, Schaffer2< Real > >::Matrix Matrix
Definition Schaffer2.hh:41
Schaffer2()
Definition Schaffer2.hh:48
Namespace for the Optimist library.
Definition Optimist.hh:87