aboutsummaryrefslogtreecommitdiff
path: root/src/Behavior.cpp
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 19:04:34 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 19:16:14 +0100
commite6ab4a8ed100d5d5b7611c74cf3ccd556f1f1d71 (patch)
tree129cf13c2f9b3eae54402300db4570815789a02a /src/Behavior.cpp
Initial commitHEADmaster
Diffstat (limited to 'src/Behavior.cpp')
-rw-r--r--src/Behavior.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/Behavior.cpp b/src/Behavior.cpp
new file mode 100644
index 0000000..15b2ad9
--- /dev/null
+++ b/src/Behavior.cpp
@@ -0,0 +1,59 @@
+#include <HyperNeat/Behavior.hpp>
+#include <HyperNeat/NoveltyMetric.hpp>
+
+using namespace hyperneat;
+
+void
+Behavior::clear()
+{
+ _characterization.assign(_characterization.size(), 0.0);
+}
+
+void
+Behavior::reset(bool archive)
+{
+ if (_toBeArchived && archive) {
+ _noveltyMetric->_archive.emplace_back(_characterization);
+ }
+
+ _noveltyScore = 0.0;
+ _toBeArchived = false;
+ _criteriaReached = _noveltyMetric->_prms._criteriaReachedByDefault;
+ _characterization.assign(_characterization.size(), 0.0);
+}
+
+double&
+Behavior::at(size_t i)
+{
+ return _characterization[i];
+}
+
+double
+Behavior::getNoveltyScore() const
+{
+ return _noveltyScore;
+}
+
+bool
+Behavior::isToBeArchived() const
+{
+ return _toBeArchived;
+}
+
+Organism&
+Behavior::getOrganism()
+{
+ return *_organism;
+}
+
+const NoveltyMetric&
+Behavior::getNoveltyMetric() const
+{
+ return *_noveltyMetric;
+}
+
+const Vector<double>&
+Behavior::getCharacterization() const
+{
+ return _characterization;
+}