1997-02-19 13:59:07 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* geqo.h
|
1997-02-19 13:59:07 +01:00
|
|
|
* prototypes for various files in optimizer/geqo
|
|
|
|
*
|
2022-01-08 01:04:57 +01:00
|
|
|
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1997-02-19 13:59:07 +01:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/optimizer/geqo.h
|
1997-02-19 13:59:07 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* contributed by:
|
|
|
|
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
|
|
|
* Martin Utesch * Institute of Automatic Control *
|
|
|
|
= = University of Mining and Technology =
|
|
|
|
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
|
|
|
|
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GEQO_H
|
|
|
|
#define GEQO_H
|
|
|
|
|
Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.
Standardize on xoroshiro128** as our basic PRNG algorithm, eliminating
a bunch of platform dependencies as well as fundamentally-obsolete PRNG
code. In addition, this API replacement will ease replacing the
algorithm again in future, should that become necessary.
xoroshiro128** is a few percent slower than the drand48 family,
but it can produce full-width 64-bit random values not only 48-bit,
and it should be much more trustworthy. It's likely to be noticeably
faster than the platform's random(), depending on which platform you
are thinking about; and we can have non-global state vectors easily,
unlike with random(). It is not cryptographically strong, but neither
are the functions it replaces.
Fabien Coelho, reviewed by Dean Rasheed, Aleksander Alekseev, and myself
Discussion: https://postgr.es/m/alpine.DEB.2.22.394.2105241211230.165418@pseudo
2021-11-29 03:32:36 +01:00
|
|
|
#include "common/pg_prng.h"
|
2019-01-29 22:49:25 +01:00
|
|
|
#include "nodes/pathnodes.h"
|
1997-11-26 02:14:33 +01:00
|
|
|
#include "optimizer/geqo_gene.h"
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2004-01-24 00:54:21 +01:00
|
|
|
|
1997-02-19 13:59:07 +01:00
|
|
|
/* GEQO debug flag */
|
|
|
|
/*
|
|
|
|
#define GEQO_DEBUG
|
2002-07-20 06:59:10 +02:00
|
|
|
*/
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2017-06-04 19:34:05 +02:00
|
|
|
/* choose one recombination mechanism here */
|
1997-02-19 13:59:07 +01:00
|
|
|
/*
|
|
|
|
#define ERX
|
|
|
|
#define PMX
|
|
|
|
#define CX
|
|
|
|
#define PX
|
|
|
|
#define OX1
|
|
|
|
#define OX2
|
|
|
|
*/
|
|
|
|
#define ERX
|
|
|
|
|
|
|
|
|
2000-05-31 02:28:42 +02:00
|
|
|
/*
|
|
|
|
* Configuration options
|
2004-01-22 00:33:34 +01:00
|
|
|
*
|
2009-07-16 22:55:44 +02:00
|
|
|
* If you change these, update backend/utils/misc/postgresql.conf.sample
|
2000-05-31 02:28:42 +02:00
|
|
|
*/
|
2004-01-24 00:54:21 +01:00
|
|
|
extern int Geqo_effort; /* 1 .. 10, knob for adjustment of defaults */
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2004-01-24 00:54:21 +01:00
|
|
|
#define DEFAULT_GEQO_EFFORT 5
|
|
|
|
#define MIN_GEQO_EFFORT 1
|
|
|
|
#define MAX_GEQO_EFFORT 10
|
2001-03-22 05:01:46 +01:00
|
|
|
|
2004-01-24 00:54:21 +01:00
|
|
|
extern int Geqo_pool_size; /* 2 .. inf, or 0 to use default */
|
2004-01-22 00:33:34 +01:00
|
|
|
|
2004-01-24 00:54:21 +01:00
|
|
|
extern int Geqo_generations; /* 1 .. inf, or 0 to use default */
|
2004-01-22 00:33:34 +01:00
|
|
|
|
2000-05-31 02:28:42 +02:00
|
|
|
extern double Geqo_selection_bias;
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2000-05-31 02:28:42 +02:00
|
|
|
#define DEFAULT_GEQO_SELECTION_BIAS 2.0
|
|
|
|
#define MIN_GEQO_SELECTION_BIAS 1.5
|
|
|
|
#define MAX_GEQO_SELECTION_BIAS 2.0
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2009-07-16 22:55:44 +02:00
|
|
|
extern double Geqo_seed; /* 0 .. 1 */
|
|
|
|
|
1997-02-19 13:59:07 +01:00
|
|
|
|
2004-01-24 00:54:21 +01:00
|
|
|
/*
|
2009-07-16 22:55:44 +02:00
|
|
|
* Private state for a GEQO run --- accessible via root->join_search_private
|
2004-01-24 00:54:21 +01:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-07-16 22:55:44 +02:00
|
|
|
List *initial_rels; /* the base relations we are joining */
|
Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.
Standardize on xoroshiro128** as our basic PRNG algorithm, eliminating
a bunch of platform dependencies as well as fundamentally-obsolete PRNG
code. In addition, this API replacement will ease replacing the
algorithm again in future, should that become necessary.
xoroshiro128** is a few percent slower than the drand48 family,
but it can produce full-width 64-bit random values not only 48-bit,
and it should be much more trustworthy. It's likely to be noticeably
faster than the platform's random(), depending on which platform you
are thinking about; and we can have non-global state vectors easily,
unlike with random(). It is not cryptographically strong, but neither
are the functions it replaces.
Fabien Coelho, reviewed by Dean Rasheed, Aleksander Alekseev, and myself
Discussion: https://postgr.es/m/alpine.DEB.2.22.394.2105241211230.165418@pseudo
2021-11-29 03:32:36 +01:00
|
|
|
pg_prng_state random_state; /* PRNG state */
|
2009-07-16 22:55:44 +02:00
|
|
|
} GeqoPrivateData;
|
2004-01-24 00:54:21 +01:00
|
|
|
|
|
|
|
|
1999-05-17 02:25:34 +02:00
|
|
|
/* routines in geqo_main.c */
|
2005-06-06 00:32:58 +02:00
|
|
|
extern RelOptInfo *geqo(PlannerInfo *root,
|
|
|
|
int number_of_rels, List *initial_rels);
|
1997-02-19 13:59:07 +01:00
|
|
|
|
1999-05-17 02:25:34 +02:00
|
|
|
/* routines in geqo_eval.c */
|
2009-07-16 22:55:44 +02:00
|
|
|
extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene);
|
|
|
|
extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
1997-02-19 13:59:07 +01:00
|
|
|
#endif /* GEQO_H */
|