25 #include <boost/numeric/conversion/cast.hpp>
26 #include <boost/random/uniform_int.hpp>
27 #include <boost/random/uniform_real.hpp>
30 #include "../population.h"
33 #include "monte_carlo.h"
35 namespace pagmo {
namespace algorithm {
55 if (pop_size == 0 || m_max_eval == 0) {
63 for (std::size_t i = 0; i < m_max_eval; ++i) {
66 tmp_x[j] = boost::uniform_real<double>(lb[j],ub[j])(
m_drng);
69 tmp_x[j] = boost::uniform_int<int>(lb[j],ub[j])(
m_urng);
77 pop.set_x(worst_idx,tmp_x);
92 std::string monte_carlo::human_readable_extra()
const
95 s <<
"max_eval:" << m_max_eval;
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
std::vector< double > decision_vector
Decision vector type.
base_ptr clone() const
Clone method.
fitness_vector cur_f
Current fitness vector.
const individual_type & get_individual(const size_type &) const
Get constant reference to individual at position n.
constraint_vector cur_c
Current constraint vector.
size_type get_dimension() const
Return global dimension.
fitness_vector objfun(const decision_vector &) const
Return fitness of pagmo::decision_vector.
size_type get_i_dimension() const
Return integer dimension.
std::vector< double > fitness_vector
Fitness vector type.
constraint_vector compute_constraints(const decision_vector &) const
Compute constraints and return constraint vector.
c_size_type get_c_dimension() const
Return global constraints dimension.
std::vector< double > constraint_vector
Constraint vector type.
const decision_vector & get_ub() const
Upper bounds getter.
monte_carlo(int=1)
Constructor from number of iterations.
container_type::size_type size_type
Population size type.
std::string get_name() const
Algorithm name.
rng_uint32 m_urng
Random number generator for unsigned integer values.
f_size_type get_f_dimension() const
Return fitness dimension.
bool compare_fc(const fitness_vector &, const constraint_vector &, const fitness_vector &, const constraint_vector &) const
Simultaneous fitness-constraint comparison.
const decision_vector & get_lb() const
Lower bounds getter.
rng_double m_drng
Random number generator for double-precision floating point values.
void evolve(population &) const
Evolve method.
decision_vector::size_type size_type
Problem's size type: the same as pagmo::decision_vector's size type.