public NeatEvolutionAlgorithm <NeatGenome> CreateEvolutionAlgorithm(BattleEvaluator <NeatGenome> evaluator, int populationSize) { Debug.Assert(populationSize > 5); _eaParams.SpecieCount = populationSize / 5; var genomeFactory = new NeatGenomeFactory(InputCount, OutputCount, _neatGenomeParams); var genomeList = genomeFactory.CreateGenomeList(populationSize, 0); return(CreateEvolutionAlgorithm(evaluator, genomeList)); }
private BattleExperiment CreateExperiment(int warriors) { var experiment = new BattleExperiment(); var battleEvaluator = new BattleEvaluator<NeatGenome>(this); experiment._ea = experiment.CreateEvolutionAlgorithm(battleEvaluator, warriors); Debug.Log("Experiment created"); return experiment; }
public IEnumerator BeginDoingOneGeneration() { if (IsEvolutionFreezed) { var eval = new BattleEvaluator<NeatGenome>(this); yield return eval.Evaluate(GenomeList); } else { yield return StartCoroutine(experiment._ea.DoOneGeneration()); } }
public NeatEvolutionAlgorithm <NeatGenome> CreateEvolutionAlgorithm(BattleEvaluator <NeatGenome> evaluator, List <NeatGenome> list) { IDistanceMetric distanceMetric = new ManhattanDistanceMetric(1.0, 0.0, 10.0); ISpeciationStrategy <NeatGenome> speciationStrategy = new KMeansClusteringStrategy <NeatGenome>(distanceMetric); IComplexityRegulationStrategy complexityRegulationStrategy = new DefaultComplexityRegulationStrategy(ComplexityCeilingType.Absolute, _complexityThreshold); NeatEvolutionAlgorithm <NeatGenome> neatEvolutionAlgorithm = new NeatEvolutionAlgorithm <NeatGenome>(_eaParams, speciationStrategy, complexityRegulationStrategy); var genomeFactory = new NeatGenomeFactory(InputCount, OutputCount, _neatGenomeParams); neatEvolutionAlgorithm.Initialize(evaluator, genomeFactory, list); _ea = neatEvolutionAlgorithm; return(neatEvolutionAlgorithm); }
public void LoadPopulation(string filename) { var battleEvaluator = new BattleEvaluator<NeatGenome>(this); experiment.CreateEvolutionAlgorithm(battleEvaluator, experiment.LoadPopulation(filename, AmoutOfWarriorsOwns)); }