1/*-------------------------------------------------------------------------
2 *
3 * geqo.h
4 * prototypes for various files in optimizer/geqo
5 *
6 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/optimizer/geqo.h
10 *
11 *-------------------------------------------------------------------------
12 */
13
14/* contributed by:
15 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
16 * Martin Utesch * Institute of Automatic Control *
17 = = University of Mining and Technology =
18 * utesch@aut.tu-freiberg.de * Freiberg, Germany *
19 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
20 */
21
22#ifndef GEQO_H
23#define GEQO_H
24
25#include "nodes/pathnodes.h"
26#include "optimizer/geqo_gene.h"
27
28
29/* GEQO debug flag */
30/*
31 #define GEQO_DEBUG
32 */
33
34/* choose one recombination mechanism here */
35/*
36 #define ERX
37 #define PMX
38 #define CX
39 #define PX
40 #define OX1
41 #define OX2
42 */
43#define ERX
44
45
46/*
47 * Configuration options
48 *
49 * If you change these, update backend/utils/misc/postgresql.conf.sample
50 */
51extern int Geqo_effort; /* 1 .. 10, knob for adjustment of defaults */
52
53#define DEFAULT_GEQO_EFFORT 5
54#define MIN_GEQO_EFFORT 1
55#define MAX_GEQO_EFFORT 10
56
57extern int Geqo_pool_size; /* 2 .. inf, or 0 to use default */
58
59extern int Geqo_generations; /* 1 .. inf, or 0 to use default */
60
61extern double Geqo_selection_bias;
62
63#define DEFAULT_GEQO_SELECTION_BIAS 2.0
64#define MIN_GEQO_SELECTION_BIAS 1.5
65#define MAX_GEQO_SELECTION_BIAS 2.0
66
67extern double Geqo_seed; /* 0 .. 1 */
68
69
70/*
71 * Private state for a GEQO run --- accessible via root->join_search_private
72 */
73typedef struct
74{
75 List *initial_rels; /* the base relations we are joining */
76 unsigned short random_state[3]; /* state for pg_erand48() */
77} GeqoPrivateData;
78
79
80/* routines in geqo_main.c */
81extern RelOptInfo *geqo(PlannerInfo *root,
82 int number_of_rels, List *initial_rels);
83
84/* routines in geqo_eval.c */
85extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene);
86extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene);
87
88#endif /* GEQO_H */
89