aboutsummaryrefslogtreecommitdiff
path: root/src/Behavior.cpp
blob: 15b2ad95f9a4167d64d04cc7e57a14cc088df96d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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;
}