27#ifndef __POPULATION_H__
28#define __POPULATION_H__
39#include "boost/smart_ptr.hpp"
44template<
class Indiv
idual_t >
54 typedef typename Individual_t::genes_t
genes_t;
56 typedef std::pair< unsigned int, individual >
ind_t;
79 if(it->second == ind) {
134 for (
unsigned int id : ids) {
151 if( survivors.count(it->first) == 0 ) {
169 if( ind_genes == ind.second->genes_m )
182 std::ostringstream filename;
183 filename <<
"hypervol.dat_" << island_id;
184 file.open(filename.str().c_str(), std::ios::out);
192 for(
size_t i=0; i<temp->objectives_m.size(); i++)
193 file << temp->objectives_m[i] <<
" ";
194 if (!temp->objectives_m.empty())
Inform & endl(Inform &inf)
std::string::iterator iterator
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
boost::shared_ptr< Individual_t > individual
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)
void keepSurvivors(std::set< unsigned int > survivors)