25 #include <boost/math/constants/constants.hpp>
29 #include "../exceptions.h"
34 namespace pagmo {
namespace problem {
47 pagmo_throw(value_error,
"the Levy5 problem's dimension must be at least 2");
63 pagmo_assert(f.size() == 1);
64 decision_vector::size_type n = x.size();
69 for ( decision_vector::size_type j=0; j<n; j+=2 ) {
70 for (
int i=1; i<=5; i++ ) {
71 isum += (double)(i) * cos((
double)(i-1)*x[j] + (
double)(i));
72 jsum += (double)(i) * cos((
double)(i+1)*x[j+1] + (
double)(i));
77 for ( decision_vector::size_type j=0; j<n; j+=2 )
78 f[0] += pow(x[j] + 1.42513,2) + pow(x[j+1] + 0.80032,2);
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
base_ptr clone() const
Clone method.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
void set_lb(const decision_vector &)
Set lower bounds from pagmo::decision_vector.
std::string get_name() const
Get problem's name.
levy5(int=2)
Constructor from dimension.
void set_ub(const decision_vector &)
Set upper bounds from pagmo::decision_vector.
std::vector< double > fitness_vector
Fitness vector type.