Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Pop::Archive< T > Struct Template Reference

The Archive struct represents a collection of individual programs. More...

#include <archive.h>

Collaboration diagram for Brush::Pop::Archive< T >:

Public Member Functions

 Archive ()
 Default constructor for the Archive struct.
 
void init (Population< T > &pop)
 Initializes the archive with individuals from a population.
 
void update (Population< T > &pop, const Parameters &params)
 Updates the archive with individuals from a population.
 
void set_objectives (vector< string > objectives)
 Sets the objectives for the archive.
 

Static Public Member Functions

static bool sortComplexity (const Individual< T > &lhs, const Individual< T > &rhs)
 Sorts the population in increasing complexity.
 
static bool sortObj1 (const Individual< T > &lhs, const Individual< T > &rhs)
 Sorts the population by the first objective.
 
static bool sameFitComplexity (const Individual< T > &lhs, const Individual< T > &rhs)
 Checks if two individuals have the same fitness complexity.
 
static bool sameObjectives (const Individual< T > &lhs, const Individual< T > &rhs)
 Checks if two individuals have the same objectives.
 

Public Attributes

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)
 

Detailed Description

template<ProgramType T>
struct Brush::Pop::Archive< T >

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
TThe program type.

Definition at line 25 of file archive.h.

Constructor & Destructor Documentation

◆ Archive()

Default constructor for the Archive struct.

Definition at line 7 of file archive.cpp.

Member Function Documentation

◆ init()

template<ProgramType T>
void Brush::Pop::Archive< T >::init ( Population< T > & pop)

Initializes the archive with individuals from a population.

Parameters
popThe population from which to initialize the archive.

Definition at line 64 of file archive.cpp.

Here is the call graph for this function:

◆ sameFitComplexity()

template<ProgramType T>
bool Brush::Pop::Archive< T >::sameFitComplexity ( const Individual< T > & lhs,
const Individual< T > & rhs )
static

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
lhsThe left-hand side individual to compare.
rhsThe right-hand side individual to compare.

Definition at line 45 of file archive.cpp.

Here is the call graph for this function:

◆ sameObjectives()

template<ProgramType T>
bool Brush::Pop::Archive< T >::sameObjectives ( const Individual< T > & lhs,
const Individual< T > & rhs )
static

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
lhsThe left-hand side individual to compare.
rhsThe right-hand side individual to compare.

Definition at line 56 of file archive.cpp.

Here is the call graph for this function:

◆ set_objectives()

template<ProgramType T>
void Brush::Pop::Archive< T >::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
objectivesThe objectives to set for the archive.

Definition at line 10 of file archive.cpp.

Here is the call graph for this function:

◆ sortComplexity()

template<ProgramType T>
bool Brush::Pop::Archive< T >::sortComplexity ( const Individual< T > & lhs,
const Individual< T > & rhs )
static

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
lhsThe left-hand side individual to compare.
rhsThe right-hand side individual to compare.

Definition at line 17 of file archive.cpp.

Here is the call graph for this function:

◆ sortObj1()

template<ProgramType T>
bool Brush::Pop::Archive< T >::sortObj1 ( const Individual< T > & lhs,
const Individual< T > & rhs )
static

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
lhsThe left-hand side individual to compare.
rhsThe right-hand side individual to compare.

Definition at line 29 of file archive.cpp.

Here is the call graph for this function:

◆ update()

template<ProgramType T>
void Brush::Pop::Archive< T >::update ( Population< T > & pop,
const Parameters & params )

Updates the archive with individuals from a population.

Parameters
popThe population from which to update the archive.
paramsThe parameters for the update.

Definition at line 108 of file archive.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ individuals

template<ProgramType T>
vector<Individual<T> > Brush::Pop::Archive< T >::individuals

individual programs in the archive

Definition at line 27 of file archive.h.

◆ selector

template<ProgramType T>
NSGA2<T> Brush::Pop::Archive< T >::selector

using NSGA2 in survival mode (nsga2 does not implement selection)

Definition at line 29 of file archive.h.

◆ sort_complexity

template<ProgramType T>
bool Brush::Pop::Archive< T >::sort_complexity

whether to sort archive by complexity

Definition at line 28 of file archive.h.


The documentation for this struct was generated from the following files: