FindBest

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

FindBest

Return to chapter overview

 

FindBest(Population As Integer, BestIndividual As Integer, BestFitness As Single)

 

Purpose: This function returns the number of the individual with the best (maximum) fitness and the value of the fitness itself.  This function is used for information purposes.  Using FindBest will be much faster than performing the same operation in Visual Basic.  Like CalcMeanFitness, this function may only be used after the fitness values of all individuals are put into the DLL's memory.  Do not use FindBest after the Reproduce function; Reproduce scales all fitness values into the appropriate range, thereby altering them.

 

Arguments:

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

BestIndividual is the variable where the number of the individual with the best fitness in the current generation will be stored.

BestFitness is the variable where the best fitness value will be stored.

 

Example: i = FindBest(PopNum, BestIndividual, BestFitness)

 

This example stores the number of the individual in the population PopNum, with the best fitness in the BestIndividual integer variable.  It also stores the fitness of this individual in the variable BestFitness.

 

Related Functions: CalcMeanFitness, GetFitness, PutFitness