blob: e2c12bab62a167ecebf1b84e154e2fa0d5be0664 (
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
|
#ifndef __NNUTILS_HPP__
#define __NNUTILS_HPP__
#include <cmath>
#include <vector>
#include <random>
#include <chrono>
#include <memory>
enum NodeClass { NEURON, MEMORY_CELL };
enum NeuralNetClass { SINGLE_MLP, DUAL_MLP, SIMPLE_RN, FULLY_RN };
typedef std::vector<float> Chromosome;
void seedRand();
float realRand(float low, float hi);
int intRand(int low, int hi);
float sigmoid(float input, float sensitivity = 1.f);
void crossover(const Chromosome &parent, const Chromosome &mother, Chromosome &child1, Chromosome &child2);
void mutate(Chromosome &chromosome, float mutationRate = 0.001f);
#endif // __NNUTILS_HPP__
|