Beispiel #1
0
    /// <summary>
    /// Calculate the average adjusted fitness for this network
    /// </summary>
    /// <returns></returns>
    public float CalulateAverageAdjustedFitness()
    {
        float totalAdjustedFitness = 0.0f;

        foreach (NeatNetwork network in population)
        {
            // Count how many networks in this species align to this individual
            int matches = 0;
            foreach (NeatNetwork other in controller.population)
            {
                if (network == other || NeatNetwork.AreSameSpecies(network, other))
                {
                    matches++;
                }
            }

            totalAdjustedFitness += network.fitness / matches;
        }

        return(totalAdjustedFitness / population.Count);
    }
Beispiel #2
0
 /// <summary>
 /// Is this network compatible with this species
 /// </summary>
 /// <returns>True if the network is part of this species</returns>
 public bool IsCompatible(NeatNetwork other)
 {
     return(NeatNetwork.AreSameSpecies(representative, other));
 }