diff options
author | sanine <sanine.not@pm.me> | 2023-10-30 01:00:53 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-10-30 01:00:53 -0500 |
commit | 17fc9fe64f4de1bc58596034c54ddb487f992c9f (patch) | |
tree | a71e5e706dcec5364e51c235603a776e52d1dac6 /src/genome/genome.js | |
parent | 9fbeab4652b075fb545cbe54984a91f91be1d627 (diff) |
add mut_genome_delete
Diffstat (limited to 'src/genome/genome.js')
-rw-r--r-- | src/genome/genome.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/genome/genome.js b/src/genome/genome.js index d35b68c..16b5e4d 100644 --- a/src/genome/genome.js +++ b/src/genome/genome.js @@ -120,3 +120,12 @@ export function mut_genome_insert( [...genome, [source, sink, weight]],
];
}
+
+
+export function mut_genome_delete(
+ [n_input, n_internal, n_output, genome], r
+) {
+ const del_idx = Math.floor(r * genome.length);
+ const new_genome = genome.filter((_, idx) => idx != del_idx);
+ return [n_input, n_internal, n_output, new_genome];
+}
|