25 #include <boost/math/constants/constants.hpp>
30 #include "../exceptions.h"
35 namespace pagmo {
namespace problem {
52 std::vector<decision_vector> best_x(1);
55 for(
int i = 0; i < n; ++i) {
56 best_x[0].push_back(0);
71 pagmo_assert(f.size() == 1);
72 std::vector<double>::size_type n = x.size();
75 double omega = 2.0 * M_PI;
76 double s1=0.0, s2=0.0;
77 double nepero=exp(1.0);
79 for (std::vector<double>::size_type i=0; i<n; i++){
81 s2 += cos(omega*x[i]);
83 f[0] = -20*exp(-0.2 * sqrt(1.0/n * s1))-exp(1.0/n*s2)+ 20 + nepero;
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
std::string get_name() const
Get problem's name.
ackley(int=1)
Constructor from dimension.
void set_best_x(const std::vector< decision_vector > &)
Sets the best known decision vectors.
base_ptr clone() const
Clone method.
void set_lb(const decision_vector &)
Set lower bounds from pagmo::decision_vector.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
void set_ub(const decision_vector &)
Set upper bounds from pagmo::decision_vector.
std::vector< double > fitness_vector
Fitness vector type.