public AddConnectionMutation(IInnovationPointGenerator connectionInnovationGenerator, IRandom random, double probabilityPerturbing, int maxAttempts) { _connectionInnovationGenerator = connectionInnovationGenerator; _random = random; _probabilityPerturbing = probabilityPerturbing; _maxAttempts = maxAttempts; }
public Connection Copy(IInnovationPointGenerator innovationGenerator) { var copy = Copy(); copy.Id = innovationGenerator.GetNextInnovation(); return(copy); }
public XORNNProvider(IInnovationPointGenerator nodeGenerator, IInnovationPointGenerator connectionGenerator, IRandom random, Genome grandFather) { _nodeGenerator = nodeGenerator; _connectionGenerator = connectionGenerator; _random = random; _grandFather = grandFather; }
public Evaluator(INeatConfiguration neatConfiguration, IGenesisGenomeProvider genomeProvider, IInnovationPointGenerator nodeInnovationGenerator, IInnovationPointGenerator connectionInnovationGenerator, IMutation addConnectionMutation, IMutation addNodeMutation, IMutation weightMutation, ICrossFunctionStrategy crossFunctionStrategy, IRandom random) { _neatConfiguration = neatConfiguration; _nodeInnovationGenerator = nodeInnovationGenerator; _connectionInnovationGenerator = connectionInnovationGenerator; _addConnectionMutation = addConnectionMutation; _addNodeMutation = addNodeMutation; _weightMutation = weightMutation; _crossFunctionStrategy = crossFunctionStrategy; _random = random; _genomes = Enumerable.Repeat(genomeProvider.GenerateGenesisGenome(), neatConfiguration.PopulationSize).ToList(); _evaluatedGenomes = new List <FitnessGenome>(); _nextGeneration = new List <Genome>(); _lastGenerationResults = new List <FitnessGenome>(); }
private Genome GenerateTemplateGenome(IInnovationPointGenerator nodeGenerator, IInnovationPointGenerator connectionGenerator) { var genome = new Genome(); genome.Nodes = Enumerable .Repeat(1, 3) .Select(n => new Node { Id = nodeGenerator.GetNextInnovation(), NodeType = NodeType.Sensor }) .ToDictionary(n => n.Id, n => n); var outputId = nodeGenerator.GetNextInnovation(); genome.Nodes.Add(outputId, new Node { Id = outputId, NodeType = NodeType.Output }); var c1 = new Connection { Id = connectionGenerator.GetNextInnovation(), InNodeId = genome.Nodes.First(n => n.Value.NodeType == NodeType.Sensor).Key, OutNodeId = genome.Nodes.First(n => n.Value.NodeType == NodeType.Output).Key, IsEnabled = true, Weight = 0.5 }; var c2 = new Connection { Id = connectionGenerator.GetNextInnovation(), InNodeId = genome.Nodes.Last(n => n.Value.NodeType == NodeType.Sensor).Key, OutNodeId = genome.Nodes.First(n => n.Value.NodeType == NodeType.Output).Key, IsEnabled = true, Weight = 0.5 }; genome.Connections = new Dictionary <int, Connection>(); genome.Connections.Add(c1.Id, c1); genome.Connections.Add(c2.Id, c2); return(genome); }
public void Init() { _nodeInnovationGenerator = Substitute.For <IInnovationPointGenerator>(); _connectionInnovationGenerator = Substitute.For <IInnovationPointGenerator>(); _randomizer = Substitute.For <IRandom>(); }
public AddConnectionMutation(IInnovationPointGenerator connectionInnovator, IRandom random, INeatConfiguration configuration) : this(connectionInnovator, random, configuration.PerturbingRate, configuration.MaxAttemptsAtFindingConnections) { }
public GenomeProvider(IInnovationPointGenerator nodeGenerator, IInnovationPointGenerator connectionGenerator, IRandom random, Genome grandFather) { _GenomeGrandfather = grandFather; _random = random; }
public GenomeProvider(IInnovationPointGenerator nodeGenerator, IInnovationPointGenerator connectionGenerator, IRandom random) { _GenomeGrandfather = GenerateTemplateGenome(nodeGenerator, connectionGenerator); _random = random; }
public WeightOfAHundred(INeatConfiguration neatConfiguration, IGenesisGenomeProvider genomeProvider, IInnovationPointGenerator nodeInnovationGenerator, IInnovationPointGenerator connectionInnovationGenerator, IMutation addConnectionMutation, IMutation addNodeMutation, IMutation weightMutation, ICrossFunctionStrategy crossFunctionStrategy, IRandom random) : base(neatConfiguration, genomeProvider, nodeInnovationGenerator, connectionInnovationGenerator, addConnectionMutation, addNodeMutation, weightMutation, crossFunctionStrategy, random) { }
public XORNNEvaluator(INeatConfiguration neatConfiguration, IGenesisGenomeProvider genomeProvider, IInnovationPointGenerator nodeInnovationGenerator, IInnovationPointGenerator connectionInnovationGenerator, IMutation addConnectionMutation, IMutation addNodeMutation, IMutation weightMutation, ICrossFunctionStrategy crossFunctionStrategy, IRandom random, ProblemDomain problemDomain) : base(neatConfiguration, genomeProvider, nodeInnovationGenerator, connectionInnovationGenerator, addConnectionMutation, addNodeMutation, weightMutation, crossFunctionStrategy, random) { _problemDomain = problemDomain; }
public AddNodeMutation(IInnovationPointGenerator nodeInnovationGenerator, IInnovationPointGenerator connectionInnovationGenerator, IRandom random) { this.nodeInnovationGenerator = nodeInnovationGenerator; this.connectionInnovationGenerator = connectionInnovationGenerator; this.random = random; }
public void Init() { _config = new DefaultNeatConfiguration(23); _innovationPointGenerator = Substitute.For <IInnovationPointGenerator>(); _random = Substitute.For <IRandom>(); }