/// <summary> /// Main genome evaluation loop with phenome caching (decode only if no cached phenome is present /// from a previous decode). /// </summary> private void Evaluate_Caching(IList <TGenome> genomeList) { Parallel.ForEach(genomeList, _parallelOptions, delegate(TGenome genome) { TPhenome phenome = (TPhenome)genome.CachedPhenome; if (null == phenome) { // Decode the phenome and store a ref against the genome. phenome = _genomeDecoder.Decode(genome); genome.CachedPhenome = phenome; } }); doneGeneratingGenomesBarrier.SignalAndWait(); Parallel.ForEach(genomeList, _parallelOptions, delegate(TGenome genome) { TPhenome phenome = (TPhenome)genome.CachedPhenome; if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { FitnessInfo fitnessInfo = _phenomeEvaluator.Evaluate(phenome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } }); doneEvaluatingGenomesBarrier.SignalAndWait(); }
/// <summary> /// Main genome evaluation loop with no phenome caching (decode on each loop). /// </summary> private void Evaluate_NonCaching(IList <TGenome> genomeList) { Parallel.ForEach(genomeList, _parallelOptions, delegate(TGenome genome) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { FitnessInfo fitnessInfo = _phenomeEvaluator.Evaluate(phenome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } }); }
private void Evaluate_NonCaching(IList <TGenome> genomeList) { // Decode and evaluate each genome in turn. foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { FitnessInfo fitnessInfo = _phenomeEvaluator.Evaluate(phenome, genome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } } }
private IEnumerator <float> Evaluate_NonCaching(IList <TGenome> genomeList) { // Decode and evaluate each genome in turn. foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { _phenomeEvaluator.Evaluate(phenome); FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } } return(null); }
private void EvaluateOne(TGenome genome, TPhenome phenome, string userName) { if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { FitnessInfo fitnessInfo = _phenomeEvaluator.Evaluate(phenome, genome.CandidateName, userName); // We don't want to update fitness in this way in the website-based project. // See evolution algorithm. //genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); //genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } }
/// <summary> /// Evaluates a collection of genomes and assigns fitness info to each. /// </summary> public void Evaluate(ICollection <TGenome> genomeList) { // Decode and evaluate each genome in turn. foreach (TGenome genome in genomeList) { // TODO: Implement phenome caching (to avoid decode cost when re-evaluating with a non-deterministic evaluation scheme). TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.FitnessInfo = _phenomeEvaluator.NullFitness; } else { genome.FitnessInfo = _phenomeEvaluator.Evaluate(phenome); } } }
private void EvaluateOne(TGenome genome, TPhenome phenome, ParallelEvaluationParameters parameters) { if (null == phenome) { // Non-viable genome. System.Diagnostics.Debug.WriteLine("Non-viable phenome found"); genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { System.Diagnostics.Debug.WriteLine("Evaluate one calls pseudoevaluator."); FitnessInfo fitnessInfo = _phenomeEvaluator.Evaluate(phenome, parameters); // We don't want to update fitness in this way in the website-based project. // See evolution algorithm. //genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); //genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } }
/// <summary> /// Evaluates a list of genomes, assigning fitness info to each. /// </summary> /// <param name="genomeList">The list of genomes to evaluate.</param> public void Evaluate(IList <TGenome> genomeList) { // Decode and evaluate genomes in parallel. Parallel.ForEach( genomeList, _parallelOptions, (genome) => { TPhenome phenome = _genomeDecoder.Decode(genome); if (phenome is null) { // Non-viable genome. genome.FitnessInfo = _phenomeEvaluationScheme.NullFitness; } else { genome.FitnessInfo = _phenomeEvaluator.Evaluate(phenome); } }); }
public IEnumerator Evaluate(IList <TGenome> genomeList) { foreach (TGenome genome in genomeList) { var phenome = genomeDecoder.Decode(genome); if (phenome == null) { genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { FitnessInfo fitnessInfo = phenomeEvaluator.Evaluate(phenome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } } yield break; }
private IEnumerator evaluateList(IList <TGenome> genomeList) { foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { yield return(Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome))); FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); genome.EvaluationInfo.SetFitness(fitnessInfo._fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessInfo._auxFitnessArr; } } }
private IEnumerator evaluateList(IList <TGenome> genomeList) { Debug.Log("---------------------- Evaluating List of genomes ----------------------"); Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < m_optimizer.Trials; i++) { m_phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { TPhenome phenome = m_genomeDecoder.Decode(genome); if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[m_optimizer.Trials]); } dict.Add(genome, phenome); Coroutiner.StartCoroutine(m_phenomeEvaluator.Evaluate(phenome)); } Debug.Log("Done creating phenomes..."); while (!BraidSimulationManager.HasControllersCreatedData()) { Debug.Log("Waiting on controllers..."); yield return(new WaitForSeconds(0.05f)); } ModelMessenger messenger = GameObject.FindObjectOfType <ModelMessenger>(); messenger.SendMessageToGH(); while (!BraidSimulationManager.HasControllersEvaluated()) { yield return(new WaitForSeconds(0.05f)); } BraidSimulationManager.AdvanceGeneration(); Debug.Log("Getting fitness values..."); foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = m_phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } Debug.Log("Done getting fitness values..."); } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < m_optimizer.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } fitness /= m_optimizer.Trials; // Averaged fitness genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } Debug.Log("---------------------- End of list evaluation ----------------------"); BraidSimulationManager.evaluationsMade = 0; }
private IEnumerator evaluateList(IList <TGenome> genomeList) { Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < _optimizer.Trials; i++) { Utility.Log("Iteration " + (i + 1)); _phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[_optimizer.Trials]); } dict.Add(genome, phenome); _optimizer.BirthGeneration = genome.BirthGeneration; _optimizer.SpeciesNumber = genome.SpecieIdx; _optimizer.ID = genome.Id; //if (!dict.ContainsKey(genome)) //{ // dict.Add(genome, phenome); // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); } while (!_optimizer.Stop) { yield return(new WaitForFixedUpdate()); } _optimizer.Stop = false; } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < _optimizer.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= _optimizer.Trials; // Averaged fitness if (fit > _optimizer.StoppingFitness) { // Utility.Log("Fitness is " + fit + ", stopping now because stopping fitness is " + _optimizer.StoppingFitness); // _phenomeEvaluator.StopConditionSatisfied = true; } genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } }
private IEnumerator evaluateList(IList <TGenome> genomeList) { Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < _optimizer.Trials; i++) { //Utility.Log("Iteration " + (i + 1)); _phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[_optimizer.Trials]); } dict.Add(genome, phenome); //if (!dict.ContainsKey(genome)) //{ // dict.Add(genome, phenome); // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); } } yield return(new WaitForSeconds(_optimizer.TrialDuration)); foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < _optimizer.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= _optimizer.Trials; // Averaged fitness if (fit > _optimizer.StoppingFitness) { // Utility.Log("Fitness is " + fit + ", stopping now because stopping fitness is " + _optimizer.StoppingFitness); // _phenomeEvaluator.StopConditionSatisfied = true; } if (_optimizer.SelectionHasBeenMade && _optimizer.SelectedGenomeId == genome.Id) { if (_optimizer.TimeSinceSelection < Optimizer.DecayTime) { fitness += (Optimizer.DecayTime - _optimizer.TimeSinceSelection) * Optimizer.SelectionBoost; } } genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } }
// called by NeatEvolutionAlgorithm at the beginning of a generation private IEnumerator EvaluateList(IList <TGenome> genomeList) { Reset(); Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < _neatSupervisor.Trials; i++) { Utility.Log("UnityParallelListEvaluator.EvaluateList -- Begin Trial " + (i + 1)); //_phenomeEvaluator.Reset(); // _phenomeEvaluator = SimpleEvalutator instance, created in Experiment.cs if (i == 0) { foreach (TGenome genome in genomeList) { // TPhenome = IBlackbox. Basically we create a blackBox from the genome. TPhenome phenome = _genomeDecoder.Decode(genome); // _genomeDecoder = NeatGenomeDecoder instance, created during the creation of the EvolutionAlgorithm in in Experiment.cs if (phenome == null) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { // Assign the IBlackBox to a unit and let the Unit perform _neatSupervisor.ActivateUnit((IBlackBox)phenome); fitnessDict.Add(genome, new FitnessInfo[_neatSupervisor.Trials]); dict.Add(genome, phenome); _neatSupervisor.ModifiedDeactivateUnit((IBlackBox)phenome); _neatSupervisor.ModifiedActivateUnit((IBlackBox)phenome); } } } // wait until the next trail, i.e. when the next evaluation should happen yield return(new WaitForSeconds(_neatSupervisor.TrialDuration)); //manter preso nesse loop até o fim das partidas // while (true) // { // yield return null; // if (true) break; // } // evaluate the fitness of all phenomes (IBlackBox) during this trial duration. foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { _phenomeEvaluator.Evaluate(phenome); FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; //added _neatSupervisor.ModifiedDeactivateUnit((IBlackBox)phenome); _neatSupervisor.ModifiedActivateUnit((IBlackBox)phenome); } } } // Get the combined fitness for all trials of each genome and save that Fitnessinfo for each genome. // Then deactivate the Unit to finish this generation. foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < _neatSupervisor.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= _neatSupervisor.Trials; // Averaged fitness if (fitness > _neatSupervisor.StoppingFitness) { Utility.Log("Fitness is " + fit + ", stopping now because stopping fitness is " + _neatSupervisor.StoppingFitness); // _phenomeEvaluator.StopConditionSatisfied = true; } genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; // The phenome has performed, deactivate the Unit the phenome was assigned to. _neatSupervisor.DeactivateUnit((IBlackBox)phenome); } } yield return(0); }
private IEnumerator evaluateList(IList <TGenome> genomeList) { Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < controller.Trials; i++) { Utility.Log("Iteration " + (i + 1)); _phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { //Bad genome genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[controller.Trials]); } dict.Add(genome, phenome); //if (!dict.ContainsKey(genome)) //{ // dict.Add(genome, phenome); // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); } yield return(new WaitForSeconds(controller.TrialDuration / 4)); } yield return(new WaitForSeconds(controller.TrialDuration)); foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < controller.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= controller.Trials; //Average fitness genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } }
private IEnumerator evaluateList(IList <TGenome> genomeList) { Debug.Log("Starting new trial"); // ui //IECManager.SetUIToSelectionState(); Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); for (int i = 0; i < _optimizer.Trials; i++) { Utility.Log("Iteration " + (i + 1)); Debug.Log("Creating Genomes..."); _phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[_optimizer.Trials]); } dict.Add(genome, phenome); //if (!dict.ContainsKey(genome)) //{ // dict.Add(genome, phenome); // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} //Debug.Log("In simpleEvaluator"); Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); } } yield return(new WaitForSeconds(_optimizer.TrialDuration)); Debug.Log("End of trial"); Debug.Log("Getting fitness values..."); foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } Debug.Log("Done getting fitness values..."); } foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < _optimizer.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= _optimizer.Trials; // Averaged fitness if (fit > _optimizer.StoppingFitness) { // Utility.Log("Fitness is " + fit + ", stopping now because stopping fitness is " + _optimizer.StoppingFitness); // _phenomeEvaluator.StopConditionSatisfied = true; } genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } Debug.Log("End of Evaluation of Genome list"); }
/// <summary> /// This is the main function in this class. It translates every genome /// (neural network description) into a phenome (functional description /// of the genome which gets input values and returns output values). /// Then it instantiates units with this phenomes as controllers and /// allows them a time to do whatever they must. Finally fitness values /// are assigned for each genome and units are destroyed. /// </summary> private IEnumerator evaluateList(IList <TGenome> genomeList) { // We do not want to lose track of which phenome corresponds to each // genome! Dictionary <TGenome, TPhenome> dict = new Dictionary <TGenome, TPhenome>(); // If there is more than one trial we need to write down the fitness // value obtained by units in each case. Dictionary <TGenome, FitnessInfo[]> fitnessDict = new Dictionary <TGenome, FitnessInfo[]>(); // Units can be tested in several trials to get an average evaluation for (int i = 0; i < _optimizer.Trials; i++) { Utility.Log("Iteration " + (i + 1)); _phenomeEvaluator.Reset(); dict = new Dictionary <TGenome, TPhenome>(); foreach (TGenome genome in genomeList) { // Makes a phenome from each genome. In some cases non-viable // genomes are allowed. Those get fitness = 0. TPhenome phenome = _genomeDecoder.Decode(genome); if (null == phenome) { // Non-viable genome. genome.EvaluationInfo.SetFitness(0.0); genome.EvaluationInfo.AuxFitnessArr = null; } else { // There may be more than one trial. Every genome needs // a fitness result for each. So we allocate enough space // in the dictionary for this (this is why the value in // the dictionary is an array). Allocation needs only // happen once, thus if (i == 0). if (i == 0) { fitnessDict.Add(genome, new FitnessInfo[_optimizer.Trials]); } dict.Add(genome, phenome); //if (!dict.ContainsKey(genome)) //{ // dict.Add(genome, phenome); // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} // This is where the unit is actually instantiated and // where its fitness is evaluated Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); } } // The previous coroutine will wait this period of time before // calculating the fitness values. yield return(new WaitForSeconds(_optimizer.TrialDuration)); // Now we can store the fitness values. foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { FitnessInfo fitnessInfo = _phenomeEvaluator.GetLastFitness(phenome); fitnessDict[genome][i] = fitnessInfo; } } } // Every genome has now a fitness value for each trial. Here we // process that information and get an average result. foreach (TGenome genome in dict.Keys) { TPhenome phenome = dict[genome]; if (phenome != null) { double fitness = 0; for (int i = 0; i < _optimizer.Trials; i++) { fitness += fitnessDict[genome][i]._fitness; } var fit = fitness; fitness /= _optimizer.Trials; // Averaged fitness // Is any average fitness greated than the fitness target? if (fit >= _optimizer.StoppingFitness) { // Utility.Log("Fitness is " + fit + ", // stopping now because stopping fitness is " + // _optimizer.StoppingFitness); _phenomeEvaluator.StopConditionSatisfied = true; } genome.EvaluationInfo.SetFitness(fitness); genome.EvaluationInfo.AuxFitnessArr = fitnessDict[genome][0]._auxFitnessArr; } } }