25 #ifndef PAGMO_MPI_ISLAND_H
26 #define PAGMO_MPI_ISLAND_H
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/thread/condition_variable.hpp>
30 #include <boost/thread/mutex.hpp>
35 #include "base_island.h"
37 #include "algorithm/base.h"
38 #include "migration/base_r_policy.h"
39 #include "migration/base_s_policy.h"
40 #include "migration/best_s_policy.h"
41 #include "migration/fair_r_policy.h"
42 #include "population.h"
43 #include "problem/base.h"
44 #include "serialization.h"
53 namespace boost {
namespace serialization {
55 template <
class Archive>
56 void save_construct_data(Archive &,
const pagmo::mpi_island *,
const unsigned int);
58 template <
class Archive>
59 inline void load_construct_data(Archive &,
pagmo::mpi_island *,
const unsigned int);
79 template <
class Archive>
80 friend void boost::serialization::save_construct_data(Archive &,
const pagmo::mpi_island *,
const unsigned int);
81 template <
class Archive>
82 friend void boost::serialization::load_construct_data(Archive &,
pagmo::mpi_island *,
const unsigned int);
96 std::string get_name()
const;
98 friend class boost::serialization::access;
99 template <
class Archive>
100 void serialize(Archive &ar,
const unsigned int)
103 ar & boost::serialization::base_object<base_island>(*this);
105 static void init_processors();
106 int acquire_processor()
const;
107 void release_processor(
int)
const;
109 static boost::mutex m_proc_mutex;
110 static boost::condition_variable m_proc_cond;
111 static boost::mutex m_mpi_mutex;
112 static boost::scoped_ptr<std::set<int> > m_available_processors;
113 static std::list<mpi_island const *> m_queue;
118 namespace boost {
namespace serialization {
120 template <
class Archive>
121 inline void save_construct_data(Archive &ar,
const pagmo::mpi_island *isl,
const unsigned int)
130 template <
class Archive>
131 inline void load_construct_data(Archive &ar,
pagmo::mpi_island *isl,
const unsigned int)
139 ::new(isl)
pagmo::mpi_island(*algo,*prob);
144 BOOST_CLASS_EXPORT_KEY(
pagmo::mpi_island)
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.
Base class for migration replacement policies.
Base class for migration selection policies.
"Choose best" migration selection policy.
virtual base_ptr clone() const =0
Clone method.
algorithm::base_ptr m_algo
Algorithm.
boost::shared_ptr< base_island > base_island_ptr
Alias for the shared pointer to a pagmo::base_island.
population m_pop
Population.