Function PGAIntegerEuclidianDistance
Defined in File integer.c
Function Documentation
-
double PGAIntegerEuclidianDistance(PGAContext *ctx, int p1, int pop1, int p2, int pop2)
Compute genetic distance of two strings.
Description
This uses the Euclidian distance metric, the square-root of the sum of all squared differences of each allele. It can be used to override the default integer genetic distance function (which uses a manhattan distance metric) using
PGASetUserFunction()
with thePGA_USERFUNCTION_GEN_DISTANCE
setting.Example
Override genetic distance function:
PGAContext *ctx; ... assert (PGAGetDataType (ctx) == PGA_DATATYPE_INTEGER); PGASetUserFunction (ctx, PGA_USERFUNCTION_GEN_DISTANCE, PGAIntegerEuclidianDistance);
- Parameters:
ctx – context variable
p1 – first string index
pop1 – symbolic constant of the population the first string is in
p2 – second string index
pop2 – symbolic constant of the population the second string is in
- Returns:
genetic euclidian distance of the two strings