Function PGAGetBestIndex

Function Documentation

int PGAGetBestIndex(PGAContext *ctx, int popidx)

Return the index of the string with the best evaluation function value in population pop.

Description

Note that in the presence of multiple evaluations, this will return

  • If all strings violate constraints the one with the least constraint violation

  • In case there exist strings without constraint violations one randomly chosen from rank 0.

Example

PGAContext *ctx;
int best;

...
best = PGAGetBestIndex (ctx, PGA_OLDPOP);

Parameters
  • ctx – context variable

  • popidx – symbolic constant of the population to find the best string in

Returns

Index of the string with the best evaluation function value