#ifndef __HYPERNEAT_NEURALNET_HPP__ #define __HYPERNEAT_NEURALNET_HPP__ #include #include namespace hyperneat { class Cppn; class NeuralNetPrms; class NeuralNet { public: class Neuron; NeuralNet() = default; void create(Cppn& cppn, const NeuralNetPrms& nnPrms); void clear(); size_t getInputsCount() const; size_t getOutputsCount() const; size_t getNeuronsCount() const; const Vector& getInputs() const; const Vector& getOutputs() const; const Vector& getNeurons() const; double getAverageActivation() const; double& inputAt(size_t i); double outputAt(size_t i) const; void cycle(); class Neuron { public: enum class Type { INPUT, HIDDEN, OUTPUT }; Neuron() = default; Neuron(const Point& position, Type type, double bias); void appendInput(); void flushOutput(); class Synapse { public: Synapse() = default; Synapse(Neuron* inputNeuron, double weight); double* _input = nullptr; Neuron* _neuron = nullptr; double _weight = 0.0; }; Vector _synapses; Point _position; Type _type = Type::HIDDEN; double _bias = 0.0; double _storedInput = 0.0; double _output = 0.0; }; private: Vector _inputs; Vector _outputs; Vector _neurons; friend class Organism; }; } #endif