-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleCTRNNMain.cpp
More file actions
34 lines (28 loc) · 920 Bytes
/
Copy pathSimpleCTRNNMain.cpp
File metadata and controls
34 lines (28 loc) · 920 Bytes
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
// ***************************************
// A very simple example program for CTRNN
// ***************************************
#include "CTRNN.h"
// Global constants
const double RunDuration = 250;
const double StepSize = 0.01;
// The main program
int main(int argc, char* argv[])
{
// Set up the circuit
CTRNN c(2);
c.SetNeuronBias(1, -2.75);
c.SetNeuronBias(2, -1.75);
c.SetConnectionWeight(1, 1, 4.5);
c.SetConnectionWeight(1, 2, -1);
c.SetConnectionWeight(2, 1, 1);
c.SetConnectionWeight(2, 2, 4.5);
// Run the circuit
c.RandomizeCircuitState(-0.5,0.5);
cout << 0.0 << " " << c.NeuronOutput(1) << " " << c.NeuronOutput(2) << endl;
for (double time = StepSize; time <= RunDuration; time += StepSize) {
c.EulerStep(StepSize);
cout << time << " " << c.NeuronOutput(1) << " " << c.NeuronOutput(2) << endl;
}
// Finished
return 0;
}