31 #ifndef SHARK_OBJECTIVEFUNCTIONS_BENCHMARKS_ELLIPSOID_H 32 #define SHARK_OBJECTIVEFUNCTIONS_BENCHMARKS_ELLIPSOID_H 54 {
return "Ellipsoid"; }
57 return m_numberOfVariables;
71 for (std::size_t i = 0; i < x.size(); i++) {
80 double sizeMinusOne = p.size() - 1.;
81 for( std::size_t i = 0; i < p.size(); i++ ){
82 sum += ::pow( m_alpha, i / sizeMinusOne ) *
sqr(p( i ) );
89 double sizeMinusOne=p.size() - 1.;
90 derivative.resize(p.size());
91 for (std::size_t i = 0; i < p.size(); i++) {
92 derivative(i) = 2 * ::pow(m_alpha, i / sizeMinusOne) * p(i);
97 std::size_t size=p.size();
98 double sizeMinusOne=p.size() - 1.;
99 derivative.gradient.resize(size);
100 derivative.hessian.resize(size,size);
101 derivative.hessian.clear();
102 for (std::size_t i = 0; i < size; i++) {
103 derivative.gradient(i) = 2 * std::pow(m_alpha, i / sizeMinusOne ) * p(i);
104 derivative.hessian(i,i) = 2 * std::pow(m_alpha, i /sizeMinusOne );
109 std::size_t m_numberOfVariables;