Fix obsolete comment regarding FSM truncation.
[PostgreSQL.git] / src / include / optimizer / geqo_recombination.h
blob19dbb70e48c1752bdf52a4d3fd466d9f2ad338cb
1 /*-------------------------------------------------------------------------
3 * geqo_recombination.h
4 * prototypes for recombination in the genetic query optimizer
6 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $PostgreSQL$
11 *-------------------------------------------------------------------------
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 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
22 /* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */
24 #ifndef GEQO_RECOMBINATION_H
25 #define GEQO_RECOMBINATION_H
27 #include "optimizer/geqo_gene.h"
29 extern void init_tour(Gene *tour, int num_gene);
32 /* edge recombination crossover [ERX] */
34 typedef struct Edge
36 Gene edge_list[4]; /* list of edges */
37 int total_edges;
38 int unused_edges;
39 } Edge;
41 extern Edge *alloc_edge_table(int num_gene);
42 extern void free_edge_table(Edge *edge_table);
44 extern float gimme_edge_table(Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table);
46 extern int gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene);
49 /* partially matched crossover [PMX] */
51 #define DAD 1 /* indicator for gene from dad */
52 #define MOM 0 /* indicator for gene from mom */
54 extern void pmx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene);
57 typedef struct City
59 int tour2_position;
60 int tour1_position;
61 int used;
62 int select_list;
63 } City;
65 extern City *alloc_city_table(int num_gene);
66 extern void free_city_table(City *city_table);
68 /* cycle crossover [CX] */
69 extern int cx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table);
71 /* position crossover [PX] */
72 extern void px(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table);
74 /* order crossover [OX1] according to Davis */
75 extern void ox1(Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table);
77 /* order crossover [OX2] according to Syswerda */
78 extern void ox2(Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table);
80 #endif /* GEQO_RECOMBINATION_H */