<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«


Return to chapter overview


CalcMeanFitness(Population As Integer, MeanFitness As Single)


Purpose: This function returns the average fitness value calculated over all individuals in the population.  This function is used for information purposes only.  It is usually much faster than performing the same operation in Visual Basic. CalcMeanFitness must be used only after the fitness values of each individual are put into the DLL's memory.  Do not use CalcMeanFitness after the Reproduce function; Reproduce scales all fitness values into the appropriate range, thereby altering them.



Population is the number of the population with which you are working.

MeanFitness is the variable where the mean fitness value will be stored.


Example: i = CalcMeanFitness(PopNum, MeanFitness)


This example calculates and stores the mean fitness value of the population, where PopNum is the number of the population.  The mean fitness value is returned in the variable MeanFitness.


Related Functions: FindBest, GetFitness, PutFitness