1 #ifndef __POPULATION_H__
2 #define __POPULATION_H__
13 #include "boost/smart_ptr.hpp"
28 template<
class Indiv
idual_t >
38 typedef typename Individual_t::genes_t
genes_t;
40 typedef std::pair< unsigned int, individual >
ind_t;
63 if(it->second == ind) {
118 for (
unsigned int id : ids) {
135 if( survivors.count(it->first) == 0 ) {
153 if( ind_genes == ind.second->genes_m )
166 std::ostringstream filename;
167 filename <<
"hypervol.dat_" << island_id;
168 file.open(filename.str().c_str(), std::ios::out);
176 for(
size_t i=0; i<temp->objectives_m.size(); i++)
177 file << temp->objectives_m[i] <<
" ";
178 if (temp->objectives_m.size() > 0)
void commit_individuals(std::set< unsigned int > ids)
indItr_t stagingEnd()
iterator end on staging area
individual get_individual(int identity)
void commit_individuals()
Individual_t::genes_t genes_t
std::map< unsigned int, individual >::iterator indItr_t
population iterator type
unsigned int last_identity
last used (= next free) ID
std::map< unsigned int, individual > stagingArea
staging area for individuals probably joining population
individual get_staging(int identity)
void keepSurvivors(std::set< unsigned int > survivors)
indItr_t begin()
iterator begin on population container
boost::shared_ptr< Individual_t > individual
indItr_t end()
iterator end on population container
unsigned int size() const
std::map< unsigned int, individual > individuals
population container holding all individuals
std::pair< unsigned int, individual > ind_t
indItr_t stagingBegin()
iterator begin on staging area
std::queue< unsigned int > freeids
queue to handle free individual IDs
void remove_individual(individual ind)
double FromFile(std::string file, const std::vector< double > &referencePoint)
unsigned int add_individual(individual ind)
indItr_t erase(indItr_t it)
erase individual
std::string::iterator iterator
double computeHypervolume(size_t island_id, const std::vector< double > &referencePoint)
Inform & endl(Inform &inf)
bool isRepresentedInPopulation(genes_t ind_genes)
check if a gene set is already represented in the population