From e6ab4a8ed100d5d5b7611c74cf3ccd556f1f1d71 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 19:04:34 +0100 Subject: Initial commit --- src/Behavior.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/Behavior.cpp (limited to 'src/Behavior.cpp') 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 +#include + +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& +Behavior::getCharacterization() const +{ + return _characterization; +} -- cgit v1.2.1