25 #ifndef PAGMO_BASE_ISLAND_H
26 #define PAGMO_BASE_ISLAND_H
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/shared_ptr.hpp>
30 #include <boost/thread/thread.hpp>
37 #include "algorithm/base.h"
38 #include "migration/base_r_policy.h"
39 #include "migration/base_s_policy.h"
40 #include "population.h"
41 #include "problem/base.h"
42 #include "serialization.h"
106 virtual base_island_ptr clone()
const = 0;
111 std::string human_readable_terse()
const;
112 std::string human_readable()
const;
113 virtual std::string get_name()
const;
119 virtual void join()
const;
121 void evolve(
int = 1);
124 std::size_t get_evolution_time()
const;
128 virtual void thread_entry();
129 virtual void thread_exit();
148 std::vector<std::pair<population::size_type, population::size_type> > accept_immigrants(std::vector<std::pair<population::size_type, population::individual_type> > &);
149 std::vector<population::individual_type> get_emigrants();
155 struct raii_thread_hook;
156 friend struct raii_thread_hook;
173 friend class boost::serialization::access;
174 template <
class Archive>
175 void serialize(Archive &ar,
const unsigned int version)
185 boost::serialization::split_member(ar, *
this, version);
187 template <
class Archive>
188 void save(Archive &,
const unsigned int)
const
190 template <
class Archive>
191 void load(Archive &,
const unsigned int)
195 m_evo_thread.reset(0);
199 std::ostream __PAGMO_VISIBLE_FUNC &
operator<<(std::ostream &,
const base_island &);
205 class island_init:
public base
208 island_init():
base(1) {}
211 return base_ptr(
new island_init(*
this));
222 class island_init:
public base
225 island_init():base() {}
228 return base_ptr(
new island_init(*
this));
230 void evolve(population &)
const {}
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
Base class for migration replacement policies.
Base class for migration selection policies.
boost::shared_ptr< base_r_policy > base_r_policy_ptr
Shared pointer to base replacement policy.
std::ostream & operator<<(std::ostream &s, const archipelago &a)
Overload stream operator for pagmo::archipelago.
migration::base_s_policy_ptr m_s_policy
Migration selection policy.
migration::base_r_policy_ptr m_r_policy
Migration replacement policy.
std::size_t m_evo_time
Total time spent by the island on evolution (in milliseconds).
algorithm::base_ptr m_algo
Algorithm.
std::vector< double > fitness_vector
Fitness vector type.
archipelago * m_archi
Pointer that, if not null, points to the archipelago containing the island.
boost::shared_ptr< base_island > base_island_ptr
Alias for the shared pointer to a pagmo::base_island.
boost::shared_ptr< base_s_policy > base_s_policy_ptr
Shared pointer to base selection policy.
population m_pop
Population.
container_type::size_type size_type
Population size type.
boost::scoped_ptr< boost::thread > m_evo_thread
Evolution thread.