This repository was archived by the owner on Nov 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from SirRade/development
Merge
- Loading branch information
Showing
21 changed files
with
478 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
include (GenerateExportHeader) | ||
project(JNF_NEAT) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") | ||
set(dir ${CMAKE_CURRENT_SOURCE_DIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${dir}/bin") | ||
set(lib_name JNF_NEAT) | ||
|
||
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) | ||
SET (LIB_TYPE STATIC) | ||
IF (BUILD_SHARED_LIBS) | ||
SET (LIB_TYPE SHARED) | ||
ENDIF (BUILD_SHARED_LIBS) | ||
SET (WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
set(SOURCE_FILES | ||
JNF_NEAT/main.cpp | ||
JNF_NEAT/body.h | ||
JNF_NEAT/gene.cpp | ||
JNF_NEAT/gene.h | ||
JNF_NEAT/gene.cpp | ||
JNF_NEAT/neural_network.h | ||
JNF_NEAT/neural_network.cpp | ||
JNF_NEAT/trained_neural_network.h | ||
JNF_NEAT/trained_neural_network.cpp | ||
JNF_NEAT/neural_network_trainer.h | ||
JNF_NEAT/neural_network_trainer.cpp | ||
JNF_NEAT/neuron.h | ||
JNF_NEAT/genome.cpp | ||
JNF_NEAT/genome.h | ||
JNF_NEAT/neural_network.cpp | ||
JNF_NEAT/neural_network.h | ||
JNF_NEAT/neural_network_trainer.cpp | ||
JNF_NEAT/neural_network_trainer.h | ||
JNF_NEAT/neuron.cpp | ||
JNF_NEAT/body.h | ||
JNF_NEAT/xor_solver.h | ||
JNF_NEAT/xor_solver.cpp | ||
JNF_NEAT/neuron.h | ||
JNF_NEAT/organism.cpp | ||
JNF_NEAT/organism.h | ||
JNF_NEAT/organism.cpp | ||
JNF_NEAT/species.h | ||
JNF_NEAT/species.cpp | ||
JNF_NEAT/genome.h | ||
JNF_NEAT/genome.cpp) | ||
|
||
JNF_NEAT/species.h | ||
JNF_NEAT/trained_neural_network.cpp | ||
JNF_NEAT/trained_neural_network.h | ||
JNF_NEAT/training_parameters.h | ||
) | ||
add_definitions(-std=c++14) | ||
add_executable(JNF_NEAT ${SOURCE_FILES}) | ||
|
||
ADD_LIBRARY(${lib_name} ${LIB_TYPE} ${SOURCE_FILES}) | ||
|
||
generate_export_header(${lib_name}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
#pragma once | ||
#include <vector> | ||
|
||
class IBody | ||
{ | ||
public: | ||
virtual ~IBody() = default; | ||
namespace JNF_NEAT { | ||
|
||
virtual void Reset() = 0; | ||
virtual void Update(const std::vector<float>& networkOutputs) = 0; | ||
virtual double GetFitness() const = 0; | ||
class IBody { | ||
public: | ||
virtual ~IBody() = default; | ||
|
||
virtual std::vector<float> ProvideNetworkWithInputs() const = 0; | ||
}; | ||
virtual void Reset() = 0; | ||
virtual void Update(const std::vector<float>& networkOutputs) = 0; | ||
virtual double GetFitness() const = 0; | ||
|
||
virtual std::vector<float> ProvideNetworkWithInputs() const = 0; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#pragma once | ||
#include <cstddef> | ||
|
||
struct Gene { | ||
public: | ||
Gene(); | ||
Gene(const Gene& other) = default; | ||
Gene(Gene&& other) = default; | ||
~Gene() = default; | ||
|
||
Gene& operator=(const Gene& other) = default; | ||
|
||
std::size_t from = 0; | ||
std::size_t to = 0; | ||
float weight = 0.0f; | ||
std::size_t historicalMarking = numberOfExistingGenes; | ||
bool isEnabled = true; | ||
bool isRecursive = false; | ||
void SetRandomWeight(); | ||
namespace JNF_NEAT { | ||
|
||
private: | ||
static std::size_t numberOfExistingGenes; | ||
}; | ||
struct Gene { | ||
public: | ||
Gene(); | ||
Gene(const Gene& other) = default; | ||
Gene(Gene&& other) = default; | ||
~Gene() = default; | ||
|
||
Gene& operator=(const Gene& other) = default; | ||
|
||
std::size_t from = 0; | ||
std::size_t to = 0; | ||
float weight = 0.0f; | ||
std::size_t historicalMarking = numberOfExistingGenes; | ||
bool isEnabled = true; | ||
bool isRecursive = false; | ||
void SetRandomWeight(); | ||
|
||
private: | ||
static std::size_t numberOfExistingGenes; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.