public Solver(IGenomeFactory <T> genomeFactory, IGenomeEvaluator <T, TScore> evaluator, ISolverLogger <T, TScore> logger, ISolverParameters solverParameters, IEnumerable <IEarlyStoppingCondition <T, TScore> > earlyStoppingConditions, IEnumerable <IGenomeReproductionStrategy <T> > genomeReproductionStrategies) { _genomeFactory = genomeFactory; _evaluator = evaluator; _logger = logger; _solverParameters = solverParameters; _earlyStoppingConditions = earlyStoppingConditions; _genomeReproductionStrategies = genomeReproductionStrategies; }
public SexualGenomeReproductionStrategy( IMutator <T> mutator, IPairingStrategy pairingStrategy, IGenomeFactory <T> genomeFactory, IGenomeDescription <T> genomeDescription, IGenomeEvaluator <T, TScore> genomeEvaluator, int childrenToCreate, int childrenToKeepPerPair) { _mutator = mutator; _pairingStrategy = pairingStrategy; _genomeFactory = genomeFactory; _genomeDescription = genomeDescription; _genomeEvaluator = genomeEvaluator; _childrenToCreate = childrenToCreate; _childrenToKeepPerPair = childrenToKeepPerPair; }
/// <summary> /// Ensure that the pre-evolved agent population facilitates the satisfaction of both their MC and the MC of the seed /// mazes. /// </summary> /// <param name="agentPopulation">The pre-evolved agent population.</param> /// <param name="mazePopulation">The maze population.</param> /// <param name="agentEvaluator">The agent evaluator.</param> /// <param name="mazeEvaluator">The maze evaluator.</param> /// <returns> /// Boolean flag indicating whether the seed agents meet their MC and facilitate satisfaction of the maze /// population MC. /// </returns> protected static bool VerifyPreevolvedSeedAgents(List <NeatGenome> agentPopulation, List <MazeGenome> mazePopulation, IGenomeEvaluator <NeatGenome> agentEvaluator, IGenomeEvaluator <MazeGenome> mazeEvaluator) { // Update agent and maze evaluators such that seed agents will be evaluated against mazes and vice versa agentEvaluator.UpdateEvaluationBaseline(mazeEvaluator.DecodeGenomes(mazePopulation)); mazeEvaluator.UpdateEvaluationBaseline(agentEvaluator.DecodeGenomes(agentPopulation)); // Run MC evaluation for both populations agentEvaluator.Evaluate(agentPopulation, 0); mazeEvaluator.Evaluate(mazePopulation, 0); // In order to be a valid seed, the agents must facilitate the satisfaction of both populations' MC // 1. The agents must all satisfy their MC with respect to the mazes // 2. The agent population must facilitate satisfaction of the maze MC (e.g. to be solve by at least one agent) return(agentPopulation.All(g => g.EvaluationInfo.IsViable) && mazePopulation.All(g => g.EvaluationInfo.IsViable)); }
public ScoredGeneration(IEnumerable <IGenomeInfo <T> > genomes, IGenomeEvaluator <T, TScore> evaluator) { IOrderedEnumerable <FitnessResult <T, TScore> > orderedFitnessResults = evaluator.GetFitnessResults(genomes); OrderedFitnessResults = orderedFitnessResults.ToArray(); }