1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Change my-function-name-- to my_function_name, and optimizer renames.

This commit is contained in:
Bruce Momjian
1999-02-13 23:22:53 +00:00
parent 8c3fff7337
commit 6724a50787
617 changed files with 2005 additions and 2031 deletions

View File

@@ -1,10 +1,10 @@
/*------------------------------------------------------------------------
*
* geqo_copy.c--
* geqo_copy.c
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_copy.c,v 1.4 1997/09/08 21:44:13 momjian Exp $
* $Id: geqo_copy.c,v 1.5 1999/02/13 23:16:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,7 +50,7 @@
#include "optimizer/geqo_gene.h"
#include "optimizer/geqo_copy.h"
/* geqo_copy--
/* geqo_copy
*
* copies one gene to another
*

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_cx.c--
* geqo_cx.c
*
* cycle crossover [CX] routines;
* CX operator according to Oliver et al
* (Proc 2nd Int'l Conf on GA's)
*
* $Id: geqo_cx.c,v 1.5 1998/09/01 03:23:04 momjian Exp $
* $Id: geqo_cx.c,v 1.6 1999/02/13 23:16:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,7 +55,7 @@
#include "optimizer/geqo_random.h"
/* cx--
/* cx
*
* cycle crossover
*/

View File

@@ -1,9 +1,9 @@
/*------------------------------------------------------------------------
*
* geqo_erx.c--
* geqo_erx.c
* edge recombination crossover [ER]
*
* $Id: geqo_erx.c,v 1.10 1998/09/01 03:23:06 momjian Exp $
* $Id: geqo_erx.c,v 1.11 1999/02/13 23:16:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ static Gene gimme_gene(Edge edge, Edge *edge_table);
static Gene edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene);
/* alloc_edge_table--
/* alloc_edge_table
*
* allocate memory for edge table
*
@@ -80,7 +80,7 @@ alloc_edge_table(int num_gene)
return edge_table;
}
/* free_edge_table--
/* free_edge_table
*
* deallocate memory of edge table
*
@@ -91,7 +91,7 @@ free_edge_table(Edge *edge_table)
pfree(edge_table);
}
/* gimme_edge_table--
/* gimme_edge_table
*
* fills a data structure which represents the set of explicit
* edges between points in the (2) input genes
@@ -150,7 +150,7 @@ gimme_edge_table(Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table)
return ((float) (edge_total * 2) / (float) num_gene);
}
/* gimme_edge--
/* gimme_edge
*
* registers edge from city1 to city2 in input edge table
*
@@ -198,7 +198,7 @@ gimme_edge(Gene gene1, Gene gene2, Edge *edge_table)
return 1;
}
/* gimme_tour--
/* gimme_tour
*
* creates a new tour using edges from the edge table.
* priority is given to "shared" edges (i.e. edges which
@@ -246,7 +246,7 @@ gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene)
}
/* remove_gene--
/* remove_gene
*
* removes input gene from edge_table.
* input edge is used
@@ -289,7 +289,7 @@ remove_gene(Gene gene, Edge edge, Edge *edge_table)
}
}
/* gimme_gene--
/* gimme_gene
*
* priority is given to "shared" edges
* (i.e. edges which both genes possess)
@@ -381,7 +381,7 @@ gimme_gene(Edge edge, Edge *edge_table)
return 0; /* to keep the compiler quiet */
}
/* edge_failure--
/* edge_failure
*
* routine for handling edge failure
*

View File

@@ -1,11 +1,11 @@
/*------------------------------------------------------------------------
*
* geqo_eval.c--
* geqo_eval.c
* Routines to evaluate query trees
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.28 1999/02/12 05:56:47 momjian Exp $
* $Id: geqo_eval.c,v 1.29 1999/02/13 23:16:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ static void geqo_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOpt
static RelOptInfo *geqo_nth(int stop, List *rels);
/*
* geqo_eval--
* geqo_eval
*
* Returns cost of a query tree as an individual of the population.
*/
@@ -91,7 +91,7 @@ geqo_eval(Query *root, Gene *tour, int num_gene)
}
/*
* gimme-tree --
* gimme_tree
* this program presumes that only LEFT-SIDED TREES are considered!
*
* 'outer_rel' is the preceeding join
@@ -179,10 +179,10 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
}
/*
* gimme-clause-joins--
* gimme_clause_joins
*
* 'outer-rel' is the relation entry for the outer relation
* 'inner-rel' is the relation entry for the inner relation
* 'outer_rel' is the relation entry for the outer relation
* 'inner_rel' is the relation entry for the inner relation
*
* Returns a list of new join relations.
*/
@@ -231,9 +231,9 @@ gimme_clause_joins(Query *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
}
/*
* gimme-clauseless-join--
* Given an outer relation 'outer-rel' and an inner relation
* 'inner-rel', create a join relation between 'outer-rel' and 'inner-rel'
* gimme_clauseless_join
* Given an outer relation 'outer_rel' and an inner relation
* 'inner_rel', create a join relation between 'outer_rel' and 'inner_rel'
*
* Returns a new join relation.
*/
@@ -245,13 +245,13 @@ gimme_clauseless_join(RelOptInfo *outer_rel, RelOptInfo *inner_rel)
}
/*
* init-join-rel--
* init_join_rel
* Creates and initializes a new join relation.
*
* 'outer-rel' and 'inner-rel' are relation nodes for the relations to be
* 'outer_rel' and 'inner_rel' are relation nodes for the relations to be
* joined
* 'joininfo' is the joininfo node(join clause) containing both
* 'outer-rel' and 'inner-rel', if any exists
* 'outer_rel' and 'inner_rel', if any exists
*
* Returns the new join relation node.
*/
@@ -315,17 +315,17 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
}
/*
* new-join-tlist--
* new_join_tlist
* Builds a join relations's target list by keeping those elements that
* will be in the final target list and any other elements that are still
* needed for future joins. For a target list entry to still be needed
* for future joins, its 'joinlist' field must not be empty after removal
* of all relids in 'other-relids'.
* of all relids in 'other_relids'.
*
* 'tlist' is the target list of one of the join relations
* 'other-relids' is a list of relids contained within the other
* 'other_relids' is a list of relids contained within the other
* join relation
* 'first-resdomno' is the resdom number to use for the first created
* 'first_resdomno' is the resdom number to use for the first created
* target list entry
*
* Returns the new target list.
@@ -362,19 +362,19 @@ new_join_tlist(List *tlist,
}
/*
* new-joininfo-list--
* new_joininfo_list
* Builds a join relation's joininfo list by checking for join clauses
* which still need to used in future joins involving this relation. A
* join clause is still needed if there are still relations in the clause
* not contained in the list of relations comprising this join relation.
* New joininfo nodes are only created and added to
* 'current-joininfo-list' if a node for a particular join hasn't already
* 'current_joininfo_list' if a node for a particular join hasn't already
* been created.
*
* 'current-joininfo-list' contains a list of those joininfo nodes that
* 'current_joininfo_list' contains a list of those joininfo nodes that
* have already been built
* 'joininfo-list' is the list of join clauses involving this relation
* 'join-relids' is a list of relids corresponding to the relations
* 'joininfo_list' is the list of join clauses involving this relation
* 'join_relids' is a list of relids corresponding to the relations
* currently being joined
*
* Returns a list of joininfo nodes, new and old.
@@ -430,7 +430,7 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
#ifdef NOTUSED
/*
* add-new-joininfos--
* add_new_joininfos
* For each new join relation, create new joininfos that
* use the join relation as inner relation, and add
* the new joininfos to those rel nodes that still
@@ -578,11 +578,11 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
/*
* final-join-rels--
* final_join_rels
* Find the join relation that includes all the original
* relations, i.e. the final join result.
*
* 'join-rel-list' is a list of join relations.
* 'join_rel_list' is a list of join relations.
*
* Returns the list of final join relations.
*/
@@ -624,11 +624,11 @@ geqo_final_join_rels(List *join_rel_list)
}
/*
* add_superrels--
* add_superrels
* add rel to the temporary property list superrels.
*
* 'rel' a rel node
* 'super-rel' rel node of a join relation that includes rel
* 'super_rel' rel node of a join relation that includes rel
*
* Modifies the superrels field of rel
*/
@@ -639,7 +639,7 @@ add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
}
/*
* nonoverlap-rels--
* nonoverlap_rels
* test if two join relations overlap, i.e., includes the same
* relation.
*
@@ -671,7 +671,7 @@ nonoverlap_sets(List *s1, List *s2)
#endif /* NOTUSED */
/*
* geqo_joinrel_size--
* geqo_joinrel_size
* compute estimate for join relation tuples, even for
* long join queries; so get logarithm of size when MAXINT overflow;
*/

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_main.c--
* geqo_main.c
* solution of the query optimization problem
* by means of a Genetic Algorithm (GA)
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_main.c,v 1.12 1999/02/03 21:16:22 momjian Exp $
* $Id: geqo_main.c,v 1.13 1999/02/13 23:16:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@
/*
* geqo--
* geqo
* solution of the query optimization problem
* similar to a constrained Traveling Salesman Problem (TSP)
*/

View File

@@ -1,11 +1,11 @@
/*------------------------------------------------------------------------
*
* geqo_misc.c--
* geqo_misc.c
* misc. printout and debug stuff
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.c,v 1.16 1999/02/12 17:24:47 momjian Exp $
* $Id: geqo_misc.c,v 1.17 1999/02/13 23:16:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@
static float avg_pool(Pool *pool);
/* avg_pool--
/* avg_pool
*
*/
static float
@@ -61,7 +61,7 @@ avg_pool(Pool *pool)
return (float) cumulative / pool->size;
}
/* print_pool--
/* print_pool
*/
void
print_pool(FILE *fp, Pool *pool, int start, int stop)
@@ -91,7 +91,7 @@ print_pool(FILE *fp, Pool *pool, int start, int stop)
}
}
/* print_gen--
/* print_gen
*
* printout for chromosome: best, worst, mean, average
*

View File

@@ -1,10 +1,10 @@
/*------------------------------------------------------------------------
*
* geqo_mutation.c--
* geqo_mutation.c
*
* TSP mutation routines
*
* $Id: geqo_mutation.c,v 1.4 1997/09/08 21:44:27 momjian Exp $
* $Id: geqo_mutation.c,v 1.5 1999/02/13 23:16:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_ox1.c--
* geqo_ox1.c
*
* order crossover [OX] routines;
* OX1 operator according to Davis
* (Proc Int'l Joint Conf on AI)
*
* $Id: geqo_ox1.c,v 1.4 1997/09/08 21:44:28 momjian Exp $
* $Id: geqo_ox1.c,v 1.5 1999/02/13 23:16:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,7 +54,7 @@
#include "optimizer/geqo_random.h"
/* ox1--
/* ox1
*
* position crossover
*/

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_ox2.c--
* geqo_ox2.c
*
* order crossover [OX] routines;
* OX2 operator according to Syswerda
* (The Genetic Algorithms Handbook, ed L Davis)
*
* $Id: geqo_ox2.c,v 1.4 1997/09/08 21:44:29 momjian Exp $
* $Id: geqo_ox2.c,v 1.5 1999/02/13 23:16:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,7 +54,7 @@
#include "optimizer/geqo_random.h"
/* ox2--
/* ox2
*
* position crossover
*/

View File

@@ -1,11 +1,11 @@
/*------------------------------------------------------------------------
*
* geqo_params.c--
* geqo_params.c
* routines for determining necessary genetic optimization parameters
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_params.c,v 1.12 1999/02/03 21:16:23 momjian Exp $
* $Id: geqo_params.c,v 1.13 1999/02/13 23:16:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,7 +63,7 @@ static int gimme_number_generations(int pool_size, int effort);
static int next_token(FILE *, char *, int);
/*
* geqo_param--
* geqo_param
* get ga parameters out of "$PGDATA/pg_geqo" file.
*/
void
@@ -303,7 +303,7 @@ next_token(FILE *fp, char *buf, int bufsz)
return c == '\n' ? '\n' : 0;
}
/* gimme_pool_size--
/* gimme_pool_size
* compute good estimation for pool size
* according to number of involved rels in a query
*/
@@ -325,7 +325,7 @@ gimme_pool_size(int string_length)
return (int) ceil(size);
}
/* gimme_number_generations--
/* gimme_number_generations
* compute good estimation for number of generations size
* for convergence
*/

View File

@@ -1,11 +1,11 @@
/*-------------------------------------------------------------------------
*
* geqo_paths.c--
* geqo_paths.c
* Routines to process redundant paths and relations
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.c,v 1.19 1999/02/12 17:24:47 momjian Exp $
* $Id: geqo_paths.c,v 1.20 1999/02/13 23:16:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,9 +31,9 @@
static List *geqo_prune_rel(RelOptInfo *rel, List *other_rels);
/*
* geqo-prune-rels--
* geqo_prune_rels
* Removes any redundant relation entries from a list of rel nodes
* 'rel-list'.
* 'rel_list'.
*
* Returns the resulting list.
*
@@ -53,8 +53,8 @@ geqo_prune_rels(List *rel_list)
}
/*
* geqo-prune-rel--
* Prunes those relations from 'other-rels' that are redundant with
* geqo_prune_rel
* Prunes those relations from 'other_rels' that are redundant with
* 'rel'. A relation is redundant if it is built up of the same
* relations as 'rel'. Paths for the redundant relation are merged into
* the pathlist of 'rel'.
@@ -91,7 +91,7 @@ geqo_prune_rel(RelOptInfo *rel, List *other_rels)
}
/*
* geqo-set-cheapest--
* geqo_set_cheapest
* For a relation 'rel' (which corresponds to a join
* relation), set pointers to the cheapest path
*/

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_pmx.c--
* geqo_pmx.c
*
* partially matched crossover [PMX] routines;
* PMX operator according to Goldberg & Lingle
* (Proc Int'l Conf on GA's)
*
* $Id: geqo_pmx.c,v 1.4 1997/09/08 21:44:33 momjian Exp $
* $Id: geqo_pmx.c,v 1.5 1999/02/13 23:16:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,7 +54,7 @@
#include "optimizer/geqo_random.h"
/* pmx--
/* pmx
*
* partially matched crossover
*/

View File

@@ -1,11 +1,11 @@
/*------------------------------------------------------------------------
*
* geqo_pool.c--
* geqo_pool.c
* Genetic Algorithm (GA) pool stuff
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_pool.c,v 1.10 1999/02/03 21:16:23 momjian Exp $
* $Id: geqo_pool.c,v 1.11 1999/02/13 23:16:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@
static int compare(const void *arg1, const void *arg2);
/*
* alloc-pool--
* alloc_pool
* allocates memory for GA pool
*/
Pool *
@@ -72,7 +72,7 @@ alloc_pool(int pool_size, int string_length)
}
/*
* free-pool--
* free_pool
* deallocates memory for GA pool
*/
void
@@ -94,7 +94,7 @@ free_pool(Pool *pool)
}
/*
* random-init-pool--
* random_init_pool
* initialize genetic pool
*/
void
@@ -114,7 +114,7 @@ random_init_pool(Query *root, Pool *pool, int strt, int stp)
}
/*
* sort-pool--
* sort_pool
* sorts input pool according to worth, from smallest to largest
*
* maybe you have to change compare() for different ordering ...
@@ -126,7 +126,7 @@ sort_pool(Pool *pool)
}
/*
* compare--
* compare
* static input function for pg_sort
*
* return values for sort from smallest to largest are prooved!
@@ -146,7 +146,7 @@ compare(const void *arg1, const void *arg2)
return -1;
}
/* alloc_chromo--
/* alloc_chromo
* allocates a chromosome and string space
*/
Chromosome *
@@ -160,7 +160,7 @@ alloc_chromo(int string_length)
return chromo;
}
/* free_chromo--
/* free_chromo
* deallocates a chromosome and string space
*/
void
@@ -170,7 +170,7 @@ free_chromo(Chromosome *chromo)
pfree(chromo);
}
/* spread_chromo--
/* spread_chromo
* inserts a new chromosome into the pool, displacing worst gene in pool
* assumes best->worst = smallest->largest
*/

View File

@@ -1,12 +1,12 @@
/*------------------------------------------------------------------------
*
* geqo_px.c--
* geqo_px.c
*
* position crossover [PX] routines;
* PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed)
*
* $Id: geqo_px.c,v 1.5 1998/06/15 19:28:37 momjian Exp $
* $Id: geqo_px.c,v 1.6 1999/02/13 23:16:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,7 +54,7 @@
#include "optimizer/geqo_random.h"
/* px--
/* px
*
* position crossover
*/

View File

@@ -1,9 +1,9 @@
/*------------------------------------------------------------------------
*
* geqo_recombination.c--
* geqo_recombination.c
* misc recombination procedures
*
* $Id: geqo_recombination.c,v 1.6 1998/09/01 03:23:15 momjian Exp $
* $Id: geqo_recombination.c,v 1.7 1999/02/13 23:16:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,7 @@
/*
* init_tour--
* init_tour
*
* Randomly generates a legal "traveling salesman" tour
* (i.e. where each point is visited only once.)
@@ -79,7 +79,7 @@ init_tour(Gene *tour, int num_gene)
pfree(tmp);
}
/* alloc_city_table--
/* alloc_city_table
*
* allocate memory for city table
*
@@ -99,7 +99,7 @@ alloc_city_table(int num_gene)
return city_table;
}
/* free_city_table--
/* free_city_table
*
* deallocate memory of city table
*

View File

@@ -1,11 +1,11 @@
/*-------------------------------------------------------------------------
*
* geqo_selection.c--
* geqo_selection.c
* linear selection scheme for the genetic query optimizer
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_selection.c,v 1.6 1999/02/03 21:16:23 momjian Exp $
* $Id: geqo_selection.c,v 1.7 1999/02/13 23:16:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@
static int linear(int max, double bias);
/* geqo_selection--
/* geqo_selection
*
* according to bias described by input parameters,
* second genes are selected from the pool
@@ -81,7 +81,7 @@ geqo_selection(Chromosome *momma, Chromosome *daddy, Pool *pool, double bias)
geqo_copy(daddy, &pool->data[second], pool->string_length);
}
/* linear--
/* linear
* generates random integer between 0 and input max number
* using input linear bias
*

View File

@@ -1,13 +1,13 @@
/*------------------------------------------------------------------------
*
* minspantree.c--
* minspantree.c
* routine to sort a join graph which is including cycles
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.9 1999/02/10 21:02:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.10 1999/02/13 23:16:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,7 +32,7 @@
#include "optimizer/geqo/geqo.h"
/*
* minspantree--
* minspantree
* The function minspantree computes the minimum spanning tree
* for a given number of nodes and a given distance function.
* For each pair of nodes found to be connected, a given