Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

geqo_selection.h File Reference

#include "optimizer/geqo.h"
Include dependency graph for geqo_selection.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void geqo_selection (PlannerInfo *root, Chromosome *momma, Chromosome *daddy, Pool *pool, double bias)

Function Documentation

void geqo_selection ( PlannerInfo root,
Chromosome momma,
Chromosome daddy,
Pool pool,
double  bias 
)

Definition at line 54 of file geqo_selection.c.

References Pool::data, geqo_copy(), linear_rand(), Pool::size, and Pool::string_length.

Referenced by geqo().

{
    int         first,
                second;

    first = linear_rand(root, pool->size, bias);
    second = linear_rand(root, pool->size, bias);

    /*
     * Ensure we have selected different genes, except if pool size is only
     * one, when we can't.
     *
     * This code was observed to hang up in an infinite loop when the
     * platform's implementation of erand48() was broken.  We now always use
     * our own version.
     */
    if (pool->size > 1)
    {
        while (first == second)
            second = linear_rand(root, pool->size, bias);
    }

    geqo_copy(root, momma, &pool->data[first], pool->string_length);
    geqo_copy(root, daddy, &pool->data[second], pool->string_length);
}