blob: d35210cc6d5491c7f6a7d4c68d0e056b41c1003d (
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
60
61
62
63
64
65
66
67
68
69
70
71
|
#ifndef __HYPERNEAT_ORGANISM_HPP__
#define __HYPERNEAT_ORGANISM_HPP__
#include <HyperNeat/Genome.hpp>
#include <HyperNeat/NeuralNet.hpp>
#include <HyperNeat/Utils/Atomic.hpp>
#include <HyperNeat/Utils/Pointer.hpp>
namespace hyperneat
{
class Behavior;
class NeuralNet;
class Population;
class NeuralNetPrms;
class Organism
{
public:
Organism(const Organism& other);
Organism& operator=(const Organism& other);
size_t getIndex() const;
void lock();
void unlock();
bool isLocked() const;
void freeze();
void unfreeze();
bool isFrozen() const;
bool isBeingGenerated() const;
size_t getSpecie() const;
bool isOld() const;
size_t getLifetime() const;
Behavior& getBehavior();
const Genome& getGenome() const;
bool isChampion() const;
Population& getPopulation() const;
void createNeuralNet();
Pointer<NeuralNet> _neuralNet;
double _fitness = 0.0;
private:
Organism(Population* population);
Organism(size_t inputs, Population* population);
void reset(bool archive = false);
size_t _index = 0;
bool _isLocked = false;
bool _isFrozen = false;
Atomic<bool> _isBeingGenerated = {false};
size_t _specie = 0;
size_t _lifetime = 0;
Behavior* _behavior = nullptr;
Genome _genome;
Population* _population = nullptr;
friend class LoadFile;
friend class Population;
friend class NoveltyMetric;
};
}
#endif
|