From 62a04f27ecbaf714c08fa0594566da83581f7a97 Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 29 Nov 2023 12:41:09 -0600 Subject: implement mutateGenomeAddInternal --- src/Genome.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Genome.hs') diff --git a/src/Genome.hs b/src/Genome.hs index 4fb063c..c3fc361 100644 --- a/src/Genome.hs +++ b/src/Genome.hs @@ -5,6 +5,8 @@ module Genome , mutateGeneSink , mutateGeneWeight , mutateGene + + , mutateGenomeAddInternal ) where @@ -67,3 +69,12 @@ mutateGene :: RandomGen a => Genome -> Gene -> a -> (Gene, a) mutateGene genome g r = let (f, r') = randomChoice [mutateGeneSource, mutateGeneSink, mutateGeneWeight] r in f genome g r' + +-- add new internal neuron +mutateGenomeAddInternal :: RandomGen a => Genome -> a -> (Genome, a) +mutateGenomeAddInternal genome r = (genome { numInternal = 1 + numInternal genome }, r) + + +-- remove an internal neuron, decrementing sources and incrementing sinks +mutateGenomeRemoveInternal :: RandomGen a => Genome -> a -> (Genome, a) +mutateGenomeRemoveInternal = undefined -- cgit v1.2.1