public void MyTestMethod() { var random = new RandomImplementation(23); INeatConfiguration configuration = new DefaultNeatConfiguration(500); var nodeInovator = new InnovationGenerator(1); var ConnectionInovator = new InnovationGenerator(1); var genomeProvider = new GenomeProvider(nodeInovator, ConnectionInovator, random); var crossFunction = new NeatCrossFunction(random, configuration); var weightMutation = new ApplyWeightMutation(random, configuration); var addNodeMutation = new AddNodeMutation(nodeInovator, ConnectionInovator, random); var addConnectionMutation = new AddConnectionMutation(ConnectionInovator, random, configuration); var evaluator = new WeightOfAHundred(configuration, genomeProvider, nodeInovator, ConnectionInovator, addConnectionMutation, addNodeMutation, weightMutation, crossFunction, random); for (int i = 0; i < 1000; i++) { evaluator.EvaluateGeneration(); Console.WriteLine($"Best Fitness: {evaluator.FittestGenome.Fitness}"); } Assert.That(evaluator.FittestGenome.Fitness > 90); }
public void test() { var random = new RandomImplementation(23); INeatConfiguration configuration = new DefaultNeatConfiguration(500); var nodeInovator = new InnovationGenerator(1); var connectionInovator = new InnovationGenerator(1); var problemDomain = new ProblemDomain( inputs: new double[, ] { { 0, 0, 1 }, { 0, 1, 1 }, { 1, 0, 1 }, { 1, 1, 1 } }, outputs: new double[, ] { { 0 }, { 1 }, { 1 }, { 0 } }); var genome = CreateOriginalGenome(nodeInovator, connectionInovator, problemDomain); var genomeProvider = new XORNNProvider(nodeInovator, connectionInovator, random, genome); var crossFunction = new NeatCrossFunction(random, configuration); var weightMutation = new ApplyWeightMutation(random, configuration); var addNodeMutation = new AddNodeMutation(nodeInovator, connectionInovator, random); var addConnectionMutation = new AddConnectionMutation(connectionInovator, random, configuration); var evaluator = new XORNNEvaluator(configuration, genomeProvider, nodeInovator, connectionInovator, addConnectionMutation, addNodeMutation, weightMutation, crossFunction, random, problemDomain); for (int i = 0; i < 1000; i++) { evaluator.EvaluateGeneration(); Console.WriteLine($"Best Fitness: {evaluator.FittestGenome.Fitness}"); } Assert.That(evaluator.FittestGenome.Fitness > 90); }