Function PGAFitness
Defined in File fitness.c
Function Documentation
-
void PGAFitness(PGAContext *ctx, int popindex)
Map the user’s evaluation function value to a fitness value.
Description
First, the user’s evaluation function value is translated to all positive values if any are negative. Next, this positive sequence is translated to a maximization problem if the user’s optimization direction was minimization. This positive sequence is then mapped to a fitness value using linear ranking, linear normalization fitness, or the identity (i.e., the evaluation function value). See Constants for Fitness Types in the user guide for allowed values. This routine is usually used after
PGAEvaluate()
is called.Example
Calculate the fitness of all strings in population
PGA_NEWPOP
after callingPGAEvaluate()
to calculate the strings evaluation value.double energy (PGAContext *ctx, int p, int pop, double *aux); PGAContext *ctx; MPI_Comm comm; ... PGAEvaluate (ctx, PGA_NEWPOP, energy, comm); PGAFitness (ctx, PGA_NEWPOP);
- Parameters:
ctx – context variable
popindex – symbolic constant of the population to calculate fitness for
- Returns:
Calculate the fitness for each string in the population via side effect