21 #include <core/utils.h> 22 #include <core/darwin.h> 29 namespace feedforward {
38 Gene(
size_t inputs,
size_t outputs);
40 void crossover(
const Gene& parent1,
const Gene& parent2,
float preference);
41 void mutate(
float mutation_std_dev);
44 friend void to_json(json& json_obj,
const Gene& gene);
45 friend void from_json(
const json& json_obj, Gene& gene);
48 struct Layer :
public cne::AnnLayer {
49 explicit Layer(
const Gene& gene);
54 void evaluate(
const vector<float>& inputs)
override;
55 void resetState()
override;
58 struct GenotypeTraits {
59 using HiddenLayerGene = feedforward::Gene;
60 using OutputLayerGene = feedforward::Gene;
63 using Genotype = cne::Genotype<GenotypeTraits>;
66 using Genotype = feedforward::Genotype;
67 using HiddenLayer = feedforward::Layer;
68 using OutputLayer = feedforward::Layer;
70 static constexpr
bool kNormalizeHiddenLayers =
true;
73 using Brain = cne::Brain<BrainTraits>;
void randomize(Matrix &w)
Randomize the values in a Matrix.
Definition: ann_dynamic.h:62
Conventional Neuroevolution (CNE) populations.
Definition: brain.h:26