Line data Source code
1 : /*-------------------------------------------------------------------------
2 : *
3 : * geqo.h
4 : * prototypes for various files in optimizer/geqo
5 : *
6 : * Portions Copyright (c) 1996-2026, 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 : /*
15 : * contributed by:
16 : * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
17 : * * Martin Utesch * Institute of Automatic Control *
18 : * = = University of Mining and Technology =
19 : * * utesch@aut.tu-freiberg.de * Freiberg, Germany *
20 : * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
21 : */
22 :
23 : #ifndef GEQO_H
24 : #define GEQO_H
25 :
26 : #include "common/pg_prng.h"
27 : #include "nodes/pathnodes.h"
28 : #include "optimizer/extendplan.h"
29 : #include "optimizer/geqo_gene.h"
30 :
31 :
32 : /* GEQO debug flag */
33 : /*
34 : * #define GEQO_DEBUG
35 : */
36 :
37 : /* choose one recombination mechanism here */
38 : /*
39 : * #define ERX
40 : * #define PMX
41 : * #define CX
42 : * #define PX
43 : * #define OX1
44 : * #define OX2
45 : */
46 : #define ERX
47 :
48 :
49 : /*
50 : * Configuration options
51 : *
52 : * If you change these, update backend/utils/misc/postgresql.conf.sample
53 : */
54 : extern PGDLLIMPORT int Geqo_effort; /* 1 .. 10, knob for adjustment of
55 : * defaults */
56 :
57 : #define DEFAULT_GEQO_EFFORT 5
58 : #define MIN_GEQO_EFFORT 1
59 : #define MAX_GEQO_EFFORT 10
60 :
61 : extern PGDLLIMPORT int Geqo_pool_size; /* 2 .. inf, or 0 to use default */
62 :
63 : extern PGDLLIMPORT int Geqo_generations; /* 1 .. inf, or 0 to use default */
64 :
65 : extern PGDLLIMPORT double Geqo_selection_bias;
66 :
67 : extern PGDLLIMPORT int Geqo_planner_extension_id;
68 :
69 : #define DEFAULT_GEQO_SELECTION_BIAS 2.0
70 : #define MIN_GEQO_SELECTION_BIAS 1.5
71 : #define MAX_GEQO_SELECTION_BIAS 2.0
72 :
73 : extern PGDLLIMPORT double Geqo_seed; /* 0 .. 1 */
74 :
75 :
76 : /*
77 : * Private state for a GEQO run --- accessible via GetGeqoPrivateData
78 : */
79 : typedef struct
80 : {
81 : List *initial_rels; /* the base relations we are joining */
82 : pg_prng_state random_state; /* PRNG state */
83 : } GeqoPrivateData;
84 :
85 : static inline GeqoPrivateData *
86 12405 : GetGeqoPrivateData(PlannerInfo *root)
87 : {
88 : /* headers must be C++-compliant, so the cast is required here */
89 12405 : return (GeqoPrivateData *)
90 12405 : GetPlannerInfoExtensionState(root, Geqo_planner_extension_id);
91 : }
92 :
93 : /* routines in geqo_main.c */
94 : extern RelOptInfo *geqo(PlannerInfo *root,
95 : int number_of_rels, List *initial_rels);
96 :
97 : /* routines in geqo_eval.c */
98 : extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene);
99 : extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene);
100 :
101 : #endif /* GEQO_H */
|