Archive#
-
template<ProgramType T>
struct Archive# The Archive struct represents a collection of individual programs.
The Archive struct is used to store individual programs in a collection. It provides functionality for initializing, updating, and sorting the archive based on complexity or objectives. The archive can be operated on by a single thread.
- Template Parameters:
T – The program type.
Public Functions
-
void init(Population<T> &pop)#
Initializes the archive with individuals from a population.
- Parameters:
pop – The population from which to initialize the archive.
-
void update(Population<T> &pop, const Parameters ¶ms)#
Updates the archive with individuals from a population.
- Parameters:
pop – The population from which to update the archive.
params – The parameters for the update.
-
void set_objectives(vector<string> objectives)#
Sets the objectives for the archive.
This function sets the objectives for the archive. The objectives are used for sorting the archive.
- Parameters:
objectives – The objectives to set for the archive.
Public Members
-
vector<Individual<T>> individuals#
individual programs in the archive
-
bool sort_complexity#
whether to sort archive by complexity
Public Static Functions
-
static bool sortComplexity(const Individual<T> &lhs, const Individual<T> &rhs)#
Sorts the population in increasing complexity.
This static function is used to sort the population in increasing complexity. It is used as a comparison function for sorting algorithms.
- Parameters:
lhs – The left-hand side individual to compare.
rhs – The right-hand side individual to compare.
-
static bool sortObj1(const Individual<T> &lhs, const Individual<T> &rhs)#
Sorts the population by the first objective.
This static function is used to sort the population by the first objective. It is used as a comparison function for sorting algorithms.
- Parameters:
lhs – The left-hand side individual to compare.
rhs – The right-hand side individual to compare.
-
static bool sameFitComplexity(const Individual<T> &lhs, const Individual<T> &rhs)#
Checks if two individuals have the same fitness complexity.
This static function is used to check if two individuals have the same fitness complexity. It is used as a comparison function for finding duplicates in the population.
- Parameters:
lhs – The left-hand side individual to compare.
rhs – The right-hand side individual to compare.
-
static bool sameObjectives(const Individual<T> &lhs, const Individual<T> &rhs)#
Checks if two individuals have the same objectives.
This static function is used to check if two individuals have the same objectives. It is used as a comparison function for finding duplicates in the population.
- Parameters:
lhs – The left-hand side individual to compare.
rhs – The right-hand side individual to compare.