-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
45 lines (38 loc) · 907 Bytes
/
Main.cpp
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
/*
* Main.cpp
*
* Created on: 08.09.2014
* Author: David
*/
#include<cmath>
#include<iostream>
#include"Link.h"
#include"Node.h"
using namespace NEAT_Expansion;
double sigmoid(double in) {
return 1. / (1. + std::exp(-in));
}
int main() {
Node* input = new Node();
Node* output = new Node(sigmoid);
Node* bias = new Node();
Link* forward = input->create_outgoing_link(output);
Link* recurrent = output->create_outgoing_link(output);
forward->set_weight(2);
recurrent->set_weight(2);
bias->create_outgoing_link(output);
for (int i = 0; i < 10; i++) {
std::cout << output->activation << std::endl;
input->activation = 0;
input->do_timestep();
output->do_timestep();
bias->do_timestep();
}
for (int i = 0; i < 10; i++) {
std::cout << output->activation << std::endl;
input->activation = 1;
input->do_timestep();
output->do_timestep();
bias->do_timestep();
}
}