aboutsummaryrefslogtreecommitdiff
path: root/src/Behavior.cpp
diff options
context:
space:
mode:
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;
+}