From d9571cb1d1df2229aa7887dd62a07507a8a33dc9 Mon Sep 17 00:00:00 2001 From: Matteo De Carlo Date: Tue, 10 Mar 2020 19:09:36 +0100 Subject: [PATCH] Fixed MultiNEAT Neural Network bug the NN needs to be activated as many times as the network is deep --- .../revolve/brains/controller/DifferentialCPG.cpp | 12 ++++++++++-- thirdparty/MultiNEAT | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cpprevolve/revolve/brains/controller/DifferentialCPG.cpp b/cpprevolve/revolve/brains/controller/DifferentialCPG.cpp index 1ff4ae481d..d355cc7e5d 100644 --- a/cpprevolve/revolve/brains/controller/DifferentialCPG.cpp +++ b/cpprevolve/revolve/brains/controller/DifferentialCPG.cpp @@ -94,6 +94,7 @@ DifferentialCPG::DifferentialCPG( // build the NN according to the genome NEAT::NeuralNetwork net; gen.BuildPhenotype(net); + unsigned int net_depth = net.CalculateNetworkDepth(); // get weights for each connection // assuming that connections are distinct for each direction @@ -109,9 +110,12 @@ DifferentialCPG::DifferentialCPG( inputs[3] = 1; std::tie(inputs[4], inputs[5], inputs[6]) = motor.first; inputs[7] = -1; + inputs[8] = 1; + net.Flush(); net.Input(inputs); - net.Activate(); + for (int i=0; i