13 ||
in(objectives, std::string(
"linear_complexity"));
19template<ProgramType T>
30template<ProgramType T>
37template<ProgramType T>
50 return lhs_obj1 > rhs_obj1;
53template<ProgramType T>
64template<ProgramType T>
72 vector<size_t> indices;
74 for (
int island =0; island< pop.
num_islands; ++island) {
76 indices.insert(indices.end(), island_indices.begin(), island_indices.end());
78 vector<vector<int>> front =
selector.fast_nds(pop, indices);
79 for (
const auto& i : front[0])
87 for (
int island =0; island< pop.
num_islands; ++island) {
90 for (
unsigned i = 0; i<indices.size(); ++i)
92 const auto& ind_ptr = pop.
individuals.at(indices.at(i));
98 const auto& t = *ind_ptr;
100 if (t.fitness.rank ==1){
120template<ProgramType T>
125 vector<size_t> indices;
127 for (
int island =0; island< pop.
num_islands; ++island) {
129 indices.insert(indices.end(), island_indices.begin(), island_indices.end());
132 vector<vector<int>> front =
selector.fast_nds(pop, indices);
133 for (
const auto& i : front[0])
Fitness fitness
aggregate fitness score
vector< size_t > get_island_indexes(int island)
vector< std::shared_ptr< Individual< T > > > individuals
bool in(const V &v, const T &i)
check if element is in vector.
< nsga2 selection operator for getting the front
unsigned int linear_complexity
The Archive struct represents a collection of individual programs.
static bool sortLinearComplexity(const Individual< T > &lhs, const Individual< T > &rhs)
void set_objectives(vector< string > objectives)
Sets the objectives for the archive.
void update(Population< T > &pop, const Parameters ¶ms)
Updates the archive with individuals from a population.
vector< Individual< T > > individuals
individual programs in the archive
bool sort_complexity
whether to sort archive by complexity
NSGA2< T > selector
using NSGA2 in survival mode (nsga2 does not implement selection)
void init(Population< T > &pop)
Initializes the archive with individuals from a population.
static bool sortObj1(const Individual< T > &lhs, const Individual< T > &rhs)
Sorts the population by the first objective.
static bool sortComplexity(const Individual< T > &lhs, const Individual< T > &rhs)
Sorts the population in increasing complexity.
static bool sameObjectives(const Individual< T > &lhs, const Individual< T > &rhs)
Checks if two individuals have the same objectives.
bool linear_complexity
Indicates if the user set linear_complexity instead of recursive complexity.
Archive()
Default constructor for the Archive struct.