Population
-
template<ProgramType T>
class Population Public Functions
-
Population()
-
inline ~Population()
-
void init(SearchSpace &ss, const Parameters ¶ms)
initialize population of programs with a starting model and/or from file
-
void init(vector<Individual<T>> &individuals, const Parameters ¶ms)
-
void save(string filename)
-
void load(string filename)
-
inline int size()
returns population size (the effective size of the individuals)
-
inline vector<size_t> get_island_indexes(int island)
-
void add_offspring_indexes(int island)
update individual vector size, distributing the expressions in num_islands
update individual vector size and island indexes
-
void update(vector<vector<size_t>> survivors)
reduce programs to the indices in survivors. Not thread safe,as it removes elements
-
inline const Individual<T> &operator[](size_t i) const
setting and getting from individuals vector (will ignore islands)
-
inline const Individual<T> &operator[](size_t i)
-
string print_models(string sep = "\n")
return population equations.
-
vector<vector<size_t>> sorted_front(unsigned rank = 1)
return complexity-sorted Pareto front indices for each island
-
vector<size_t> hall_of_fame(unsigned rank = 1)
-
void migrate()
Public Members
-
size_t pop_size
-
int num_islands
-
float mig_prob
-
bool linear_complexity
Indicates if the user set linear_complexity instead of recursive complexity.
-
vector<std::shared_ptr<Individual<T>>> individuals
-
vector<vector<size_t>> island_indexes
-
struct SameFitComplexity
check for same fitness and complexity to filter uniqueness.
Public Functions
-
inline SameFitComplexity(Population<T> &p)
-
inline bool operator()(size_t i, size_t j)
Public Members
-
Population<T> &pop
-
inline SameFitComplexity(Population<T> &p)
-
struct SortComplexity
Sort each island in increasing complexity. This is not thread safe. I should set complexities of the whole population before calling it, and use get_complexity instead.
Public Members
-
Population &pop
-
Population &pop
-
struct SortLinearComplexity
Public Functions
-
inline SortLinearComplexity(Population &p)
-
inline bool operator()(size_t i, size_t j)
Public Members
-
Population &pop
-
inline SortLinearComplexity(Population &p)
-
Population()