5 #ifndef DIGNEA_NSFEATURES_H
6 #define DIGNEA_NSFEATURES_H
8 #include <dignea/distances/Distance.h>
10 #include <dignea/searches/NoveltySearch.h>
11 #include <dignea/searches/Search.h>
17 #include <nlohmann/json.hpp>
38 const float &threshold = 2000,
39 const float &finalThresh = 2000,
const int &k = 15,
44 virtual json to_json()
override;
47 virtual vector<Descriptor> beforeRun(
const vector<S> &population)
override;
49 virtual vector<Descriptor> beforeCmpFinals(
50 const vector<S> &population)
override;
52 virtual void insertFinal(
const S &solution)
override;
71 const float &threshold,
const float &finalThresh,
72 const int &k,
bool warmUp)
73 :
NoveltySearch<S>(move(dist), threshold, finalThresh, k), warmed(warmUp) {
97 vector<Descriptor> combinedPop;
98 combinedPop.reserve(population.size() + this->noveltyArchive.size());
99 for (
const S &solution : population) {
100 combinedPop.push_back(solution.getFeatures());
102 for (
const S &solution : this->noveltyArchive) {
103 combinedPop.push_back(solution.getFeatures());
111 template <
typename S>
113 vector<Descriptor> descriptors;
114 descriptors.reserve(population.size());
115 for (
const S &solution : population) {
116 descriptors.push_back(solution.getFeatures());
128 template <
typename S>
130 this->finalSs.push_back(solution);
131 this->finalSsDesc.push_back(solution.getFeatures());
140 template <
typename S>
143 data[
"name"] =
"NSFeatures";
144 data[
"warm-up"] = this->warmed;
nlohmann::json json
Definition: MinKnap.h:85
Class to represent the Novelty Search Algorithm This specialization is exclusively for EIG because it...
Definition: NSFeatures.h:33
virtual json to_json() override
Generates a json object with the relevant information of the class.
Definition: NSFeatures.h:141
virtual vector< Descriptor > beforeRun(const vector< S > &population) override
Performs computational work necessary for running the NS This method creates a combined population us...
Definition: NSFeatures.h:96
virtual void insertFinal(const S &solution) override
Method to insert a new individual into the noveltyArchive of novelty Ss.
Definition: NSFeatures.h:129
Class to represent the Novelty Search Algorithm.
Definition: NoveltySearch.h:50