27#ifndef __POPULATION_H__
28#define __POPULATION_H__
43template<
class Indiv
idual_t >
53 typedef typename Individual_t::genes_t
genes_t;
55 typedef std::pair< unsigned int, individual >
ind_t;
58 typedef typename std::map<unsigned int, individual>::iterator
indItr_t;
78 if(it->second == ind) {
133 for (
unsigned int id : ids) {
150 if( survivors.count(it->first) == 0 ) {
168 if( ind_genes == ind.second->genes_m )
181 std::ostringstream filename;
182 filename <<
"hypervol.dat_" << island_id;
183 file.open(filename.str().c_str(), std::ios::out);
185 file <<
"#" << std::endl;
191 for(
size_t i=0; i<temp->objectives_m.size(); i++)
192 file << temp->objectives_m[i] <<
" ";
193 if (!temp->objectives_m.empty())
197 file <<
"#" << std::endl;
double FromFile(std::string file, const std::vector< double > &referencePoint)
std::map< unsigned int, individual > stagingArea
staging area for individuals probably joining population
indItr_t erase(indItr_t it)
erase individual
std::pair< unsigned int, individual > ind_t
unsigned int size() const
std::map< unsignedint, individual >::iterator indItr_t
population iterator type
double computeHypervolume(size_t island_id, const std::vector< double > &referencePoint)
Individual_t::genes_t genes_t
std::map< unsigned int, individual > individuals
population container holding all individuals
void commit_individuals()
bool isRepresentedInPopulation(genes_t ind_genes)
check if a gene set is already represented in the population
individual get_individual(int identity)
unsigned int add_individual(individual ind)
void remove_individual(individual ind)
unsigned int last_identity
last used (= next free) ID
indItr_t stagingBegin()
iterator begin on staging area
std::queue< unsigned int > freeids
queue to handle free individual IDs
indItr_t end()
iterator end on population container
void commit_individuals(std::set< unsigned int > ids)
indItr_t begin()
iterator begin on population container
indItr_t stagingEnd()
iterator end on staging area
individual get_staging(int identity)
std::shared_ptr< Individual_t > individual
void keepSurvivors(std::set< unsigned int > survivors)