dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
NoveltySearch< S > Class Template Reference

Class to represent the Novelty Search Algorithm. More...

#include <NoveltySearch.h>

Inheritance diagram for NoveltySearch< S >:
Search< S > NSFeatures< S > NSPerformance< S >

Public Member Functions

 NoveltySearch (unique_ptr< Distance< float >> dist, const float &threshold=2000, const float &finalThresh=0.0001, const int &k=15)
 Creates a new Novelty Search instance. More...
 
Front< S > getResults () override
 Returns the results obtained by the Novelty Search in a Front object. More...
 
vector< S > run (vector< S > &population, const Problem< S > *problem) override
 Novelty Search Algorithm It looks for novelty using the genotypes of the individuals in the population. Computes the sparseness of each individual in the noveltyArchive and population. More...
 
virtual void cmpFinals (vector< S > &population, const Problem< S > *problem=nullptr)
 Compares the individuals in the population against the neighbors inside the archive of final Ss. If the score is good enough the individual will be included inside the archive of final solutions. More...
 
virtual void insertIntoArchive (const S &solution)
 Method to insert a new individual into the noveltyArchive of novelty solutions. More...
 
const vector< S > & getArchive () const
 
virtual json to_json ()
 
float getThreshold () const
 
float getK () const
 
float getFinalThresh () const
 
- Public Member Functions inherited from Search< S >
 Search ()=default
 Constructs a default Search.
 

Protected Member Functions

virtual vector< Descriptor > beforeRun (const vector< S > &population)
 Performs computational work necessary for running the NS This method creates a combined population using the individuals from the NS archive and the population. The resulting vector contains the features of each individual. More...
 
virtual vector< Descriptor > beforeCmpFinals (const vector< S > &population)
 
virtual void insertFinal (const S &solution)
 Method to insert a new individual into the final set of solutions The default behaviour is to get all the variables of the solution. More...
 

Protected Attributes

unique_ptr< Distance< float > > distance
 
vector< S > noveltyArchive
 
vector< S > finalSs
 
vector< Descriptor > finalSsDesc
 
float threshold
 
float finalSThreshold
 
int k
 

Detailed Description

template<typename S>
class NoveltySearch< S >

Class to represent the Novelty Search Algorithm.

Template Parameters
P
S

Constructor & Destructor Documentation

◆ NoveltySearch()

template<typename S >
NoveltySearch< S >::NoveltySearch ( unique_ptr< Distance< float >>  dist,
const float &  threshold = 2000,
const float &  finalThresh = 0.0001,
const int &  k = 15 
)
explicit

Creates a new Novelty Search instance.

Template Parameters
P
S
Parameters
threshold
dist
k

Member Function Documentation

◆ beforeRun()

template<typename S >
vector< Descriptor > NoveltySearch< S >::beforeRun ( const vector< S > &  population)
protectedvirtual

Performs computational work necessary for running the NS This method creates a combined population using the individuals from the NS archive and the population. The resulting vector contains the features of each individual.

Template Parameters
MS
Parameters
population

Reimplemented in NSPerformance< S >, and NSFeatures< S >.

◆ cmpFinals()

template<typename S >
void NoveltySearch< S >::cmpFinals ( vector< S > &  population,
const Problem< S > *  problem = nullptr 
)
virtual

Compares the individuals in the population against the neighbors inside the archive of final Ss. If the score is good enough the individual will be included inside the archive of final solutions.

Template Parameters
Problem
S
T
Parameters
population

◆ getResults()

template<typename S >
Front< S > NoveltySearch< S >::getResults
overridevirtual

Returns the results obtained by the Novelty Search in a Front object.

Template Parameters
Problem
S
T
Returns

Implements Search< S >.

◆ insertFinal()

template<typename S >
void NoveltySearch< S >::insertFinal ( const S &  solution)
protectedvirtual

Method to insert a new individual into the final set of solutions The default behaviour is to get all the variables of the solution.

Template Parameters
Problem
S
T
Parameters
S

Reimplemented in NSFeatures< S >, and NSPerformance< S >.

◆ insertIntoArchive()

template<typename S >
void NoveltySearch< S >::insertIntoArchive ( const S &  solution)
virtual

Method to insert a new individual into the noveltyArchive of novelty solutions.

Template Parameters
Problem
S
T
Parameters
S

◆ run()

template<typename S >
vector< S > NoveltySearch< S >::run ( vector< S > &  population,
const Problem< S > *  problem 
)
overridevirtual

Novelty Search Algorithm It looks for novelty using the genotypes of the individuals in the population. Computes the sparseness of each individual in the noveltyArchive and population.

Template Parameters
Problem
S
T
Parameters
population
problem
Returns

Implements Search< S >.


The documentation for this class was generated from the following file: