25 #include <boost/numeric/conversion/cast.hpp>
31 #include "string_match.h"
33 namespace pagmo {
namespace problem {
55 for (std::string::size_type i = 0; i < m_str.size(); ++i) {
56 retval += std::abs(static_cast<char>(x[boost::numeric_cast<size_type>(i)]) - m_str[i]);
68 for (decision_vector::size_type i = 0; i < x.size(); ++i) {
76 return std::string(
"\tString: \"") + m_str +
"\"\n";
81 return "String match";
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
string_match(const std::string &)
Constructor from C++ string.
std::string pretty(const decision_vector &x) const
Returns the encoded string.
void objfun_impl(fitness_vector &, const decision_vector &) const
Objective function implementation.
std::vector< double > fitness_vector
Fitness vector type.
std::string get_name() const
Get problem's name.
base_ptr clone() const
Clone method.
std::string human_readable_extra() const
Extra information in human readable format.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.