27 #include "../exceptions.h"
29 #include "../population.h"
33 namespace pagmo {
namespace problem {
54 m_translation(translation)
57 pagmo_throw(value_error,
"The size of the shifting vector must be equal to the problem dimension");
59 configure_shifted_bounds(m_translation);
84 configure_shifted_bounds(m_translation);
102 p.get_ic_dimension(),
106 for (
size_t i=0; i< m_translation.size();++i) {
107 m_translation[i] = (2*((double) rand() / (RAND_MAX))-1) * (p.
get_ub()[i]-p.
get_lb()[i]);
109 configure_shifted_bounds(m_translation);
119 void shifted::configure_shifted_bounds(
const decision_vector & translation)
125 shifted_lb[i] += translation[i];
126 shifted_ub[i] += translation[i];
141 x_translated[i] = x[i] - m_translation[i];
169 return m_translation;
183 std::ostringstream oss;
185 oss <<
"\n\tShift vector: " << m_translation << std::endl;
const decision_vector & get_shift_vector() const
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
size_type get_dimension() const
Return global dimension.
shifted(const base &, const decision_vector &)
std::vector< double > fitness_vector
Fitness vector type.
std::vector< double > constraint_vector
Constraint vector type.
const decision_vector & get_ub() const
Upper bounds getter.
void objfun_impl(fitness_vector &, const decision_vector &) const
base_ptr clone() const
Clone method.
const decision_vector & get_lb() const
Lower bounds getter.
std::string human_readable_extra() const
Extra human readable info for the problem.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.
std::string get_name() const
Get problem's name.
decision_vector deshift(const decision_vector &) const
decision_vector::size_type size_type
Problem's size type: the same as pagmo::decision_vector's size type.