private static void ReadNeatReproductionAsexualSettings(
     INeatExperiment <T> target, JsonElement jelem)
 {
     if (jelem.TryGetProperty("reproductionAsexualSettings", out JsonElement settingsElem))
     {
         NeatReproductionAsexualSettingsJsonReader.Read(target.ReproductionAsexualSettings, settingsElem);
     }
 }
Example #2
0
        private static void ReadNeatReproductionAsexualSettings(
            INeatExperiment <T> target, JObject jobj)
        {
            JObject settingsJobj = (JObject)jobj["reproductionAsexualSettings"];

            if (settingsJobj != null)
            {
                NeatReproductionAsexualSettingsJsonReader.Read(target.ReproductionAsexualSettings, settingsJobj);
            }
        }
    public void Read()
    {
        JsonDocument jdoc = JsonDocument.Parse(
            @"{
    ""connectionWeightMutationProbability"":0.11,
    ""addNodeMutationProbability"":0.22,
    ""addConnectionMutationProbability"":0.33,
    ""deleteConnectionMutationProbability"":0.34
}");
        // Init a default settings object.
        var settings = new NeatReproductionAsexualSettings();

        // Read json properties into the settings object.
        NeatReproductionAsexualSettingsJsonReader.Read(settings, jdoc.RootElement);

        // Assert the expected values.
        Assert.Equal(0.11, settings.ConnectionWeightMutationProbability);
        Assert.Equal(0.22, settings.AddNodeMutationProbability);
        Assert.Equal(0.33, settings.AddConnectionMutationProbability);
        Assert.Equal(0.34, settings.DeleteConnectionMutationProbability);
    }
        public void Read()
        {
            JObject jobj = JObject.Parse(
                @"{
    'connectionWeightMutationProbability':0.11,
    'addNodeMutationProbability':0.22,
    'addConnectionMutationProbability':0.33,
    'deleteConnectionMutationProbability':0.44,
}");
            // Init a default settings object.
            var settings = new NeatReproductionAsexualSettings();

            // Read json properties into the settings object.
            NeatReproductionAsexualSettingsJsonReader.Read(settings, jobj);

            // Assert the expected values.
            Assert.AreEqual(0.11, settings.ConnectionWeightMutationProbability);
            Assert.AreEqual(0.22, settings.AddNodeMutationProbability);
            Assert.AreEqual(0.33, settings.AddConnectionMutationProbability);
            Assert.AreEqual(0.44, settings.DeleteConnectionMutationProbability);
        }