Beispiel #1
0
        public void TestPerturbNeuronMutator()
        {
            var mutator = new PerturbNeuronMutator(1.0f, 0.25f);

            var mutatedGenotype = new Genotype(genotype);
            var mutationResults = new MutationResults();

            mutator.Mutate(mutatedGenotype, mutationResults);

            Assert.AreEqual(3, mutationResults.perturbedNeurons);

            // Compare gene counts
            var comparer = new GenotypeShapeEqualityComparer();

            Assert.That(comparer.Equals(mutatedGenotype, genotype));
        }
Beispiel #2
0
        public void TestReplaceSynapseMutator()
        {
            var mutator = new ReplaceSynapseMutator(1.0f);

            var mutatedGenotype = new Genotype(genotype);
            var mutationResults = new MutationResults();

            mutator.Mutate(mutatedGenotype, mutationResults);

            Assert.AreEqual(mutationResults.replacedSynapses, 3);

            // Compare gene counts
            var comparer = new GenotypeShapeEqualityComparer();

            Assert.That(comparer.Equals(mutatedGenotype, genotype));
        }