PostgreSQL Source Code  git master
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.


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

Function Documentation

◆ geqo_selection()

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

Definition at line 54 of file geqo_selection.c.

56 {
57  int first,
58  second;
60  first = linear_rand(root, pool->size, bias);
61  second = linear_rand(root, pool->size, bias);
63  /*
64  * Ensure we have selected different genes, except if pool size is only
65  * one, when we can't.
66  */
67  if (pool->size > 1)
68  {
69  while (first == second)
70  second = linear_rand(root, pool->size, bias);
71  }
73  geqo_copy(root, momma, &pool->data[first], pool->string_length);
74  geqo_copy(root, daddy, &pool->data[second], pool->string_length);
75 }
void geqo_copy(PlannerInfo *root, Chromosome *chromo1, Chromosome *chromo2, int string_length)
Definition: geqo_copy.c:45
static int linear_rand(PlannerInfo *root, int pool_size, double bias)
tree ctl root
Definition: radixtree.h:1884
int string_length
Definition: geqo_gene.h:42
int size
Definition: geqo_gene.h:41
Chromosome * data
Definition: geqo_gene.h:40

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

Referenced by geqo().