dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
KNN.h File Reference
#include <dignea/core/Solution.h>
#include <dignea/distances/Distance.h>
#include <dignea/searches/NoveltySearch.h>
#include <functional>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  KNN
 K-Nearest Neighbours Algorithm. More...
 

Typedefs

using neighborT = pair< float, int >
 Data type which represents a close neighbours. The first value is the distance to the individual The second value is the index of the neighbour in the array (Distance_to_other, other_index) More...
 
using neighVector = vector< neighborT >
 Vector of neighbours Each element is of type neighborT. [(Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1)]. More...
 
using neighMatrix = vector< neighVector >
 Data type which represents a matrix of close neighbours. The first value is the index of the neighbour in the array The second value is the distance to the individual [ [ (Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1) ], [ (Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1) ] ]. More...
 
using Descriptor = vector< float >
 

Functions

vector< float > sparseness (const vector< Descriptor > &population, Distance< float > *metric, const int k)
 Computes the sparseness of all individuals in the population vector Based on the Novelty Search from Exploiting Open-Endedness to Solve Problems Through the Search for Novelty. More...
 
float sparseness (const Descriptor &solution, const vector< Descriptor > &population, Distance< float > *metric, const int k)
 Computes the sparseness score of the individual against the rest of individuals in the population list Based on the Novelty Search from Exploiting Open-Endedness to Solve Problems Through the Search for Novelty. More...
 

Detailed Description

Author
Alejandro Marrero (amarr.nosp@m.erd@.nosp@m.ull.e.nosp@m.du.e.nosp@m.s)
Version
0.1
Date
2022-10-11

Typedef Documentation

◆ neighborT

using neighborT = pair<float, int>

Data type which represents a close neighbours. The first value is the distance to the individual The second value is the index of the neighbour in the array (Distance_to_other, other_index)

Template Parameters
T

◆ neighMatrix

using neighMatrix = vector<neighVector>

Data type which represents a matrix of close neighbours. The first value is the index of the neighbour in the array The second value is the distance to the individual [ [ (Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1) ], [ (Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1) ] ].

Template Parameters
T

◆ neighVector

using neighVector = vector<neighborT>

Vector of neighbours Each element is of type neighborT. [(Distance_to_other_0, other_index_0), (Distance_to_other_1, other_index_1), (...), (Distance_to_other_n-1, other_index_n-1)].

Template Parameters
T

Function Documentation

◆ sparseness() [1/2]

float sparseness ( const Descriptor &  solution,
const vector< Descriptor > &  population,
Distance< float > *  metric,
const int  k 
)

Computes the sparseness score of the individual against the rest of individuals in the population list Based on the Novelty Search from Exploiting Open-Endedness to Solve Problems Through the Search for Novelty.

Template Parameters
T
Parameters
individual
neighbours
metric
k
Returns
T

◆ sparseness() [2/2]

vector<float> sparseness ( const vector< Descriptor > &  population,
Distance< float > *  metric,
const int  k 
)

Computes the sparseness of all individuals in the population vector Based on the Novelty Search from Exploiting Open-Endedness to Solve Problems Through the Search for Novelty.

Template Parameters
T
Parameters
individual
neighbours
metric
k
Returns
T