public bool TryGetFitness(IGenotype <int, int> genotype, out float fitness) { var _fitnessIsCalculated = calculatedFitnesses.TryGetValue(genotype.ToString(), out fitness); if (!_fitnessIsCalculated) { for (int y = 0; y < genotype.GetGenotypeSize(); y++) { for (int x = y + 1; x < genotype.GetGenotypeSize(); x++) { fitness += distance[x, y] * (flow[genotype.GetGene(y).GetValue(), genotype.GetGene(x).GetValue()] + flow[genotype.GetGene(x).GetValue(), genotype.GetGene(y).GetValue()]); } } } return(_fitnessIsCalculated); }
public int GetGenotypeSize() { return(genotype.GetGenotypeSize()); }