1 /**********
2 *
3 * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
4 * University of Manchester, UK. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 *
9 * . Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * . Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * . Neither the name of the University of Manchester nor the names of its
17 * contributors may be used to endorse or promote products derived from this
18 * software without specific prior written permission.
19 *
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 **********
34 *
35 * Program : TINA
36 * File :
37 * Date :
38 * Version :
39 * CVS Id :
40 *
41 * Author : paul.bromiley@man.ac.uk
42 *
43 * Notes :
44 *
45 *********
46 */
47
48 #ifndef TINA_MATH_NUM_GENALG_HDR
49 #define TINA_MATH_NUM_GENALG_HDR
50
51 #include <tina/sys/sysDef.h>
52 #include <tina/sys/sysPro.h>
53 #include <tina/math/math_NumDef.h>
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58
59 #define Bit(mask,num) (mask&(1<<num))
60
61 double pab_rand(void);
62 void genome_header_copy(Genome *parent, Genome *child);
63 void closest_genome_header_init(Genome *genome, List *genome_list);
64 void genome_header_generator(Genome *genome, int no_points, List *genome_list);
65 Genome *labelled_solution_generator(int no_points, List *genome_list);
66 List *labelled_population_generator(int no_genomes, int no_points);
67 Genome *genome_copy(Genome *genome);
68 Genome *genome_free(Genome *genome);
69 List *genome_list_free(List *genome_list);
70 void genome_backup(List *genome_list);
71 void genome_output(List *genome_list);
72 List *genome_input(void);
73 List *random_list_select(List *list);
74 void selection_manager_listsort(List *genome_list, void **breeding_pair);
75 void selection_manager_voronoid(List *genome_list, void **breeding_pair);
76 void selection_manager_random(List *genome_list, void **breeding_pair);
77 void **cloner(void **breeding_pair);
78 Match *point_list_el_copy(Match *point_list_el);
79 void **crossover(void **breeding_pair);
80 void **realval_crossover(void **breeding_pair);
81 void **breeding_manager(void **breeding_pair);
82 void mutation_coordinate(Genome *genome);
83 void mutation_header(Genome *genome);
84 void mutation_manager(Genome *genome);
85 void evaluate_constraints(void **child_pair);
86 List *list_point_rm(List *at, List *list);
87 double point_distance_func(double *point1, double *point2);
88 void genome_point_list_sorter(Genome *genome);
89 int patricide_comparator(Genome *parent, Genome *child);
90 void patricide_direction_assign(Genome *parent, Genome *child);
91 void simple_patricide(void **breeding_pair, void **child_pair);
92 void patricide_manager(void **breeding_pair, void **child_pair);
93 List *so_extracted_set_manager(void **breeding_pair, List *genome_list,
94 List *extracted_set_list);
95 List *mo_extracted_set_manager(void **breeding_pair, List *genome_list,
96 List *extracted_set_list);
97 List *choice_extracted_set_manager(void **breeding_pair, List *genome_list, List *extracted_set_list);
98 void ga_init_coords( int pop_size, /* The number of solutions in the population */
99 int no_points, /* The number of points in each solution */
100 int dimensionality, /* The dimensionality of the space */
101 int no_objective_functions, /* The number of objective functions */
102 int no_mutation_probabilities, /* The number of elements in the mutation prob vector */
103 double *init_mutation_probabilities, /* Init version of the mutation prob vector */
104 double **coords_array, /* Array of spatial limits for this problem */
105 int max_es_length, /* Maximum size of the extracted set */
106 int ext_age, /* No of breeding cycles before extraction */
107 int no_mons, /* no of items in the monitor vector */
108 double spatial_accuracy, /* Spatial resolution required */
109 int backup_iterations, /* No of iterations between population backups */
110 int initialise_alg_time /* Start time offset */
111 );
112 void ga_init_pathnames (char *input_path, /* The pathname for the input file */
113 char *output_path, /* The pathname for the output file */
114 char *backup_path /* The pathname for the backup file */
115 );
116 void ga_init_functions( void (*p_cost_evaluation_func)(), /* manager for objective function calls */
117 void (*p_selection_manager_func)(), /* Function to select the breeding pair */
118 void **(*p_breeding_manager_func)(), /* Breeding manager function */
119 void **(*p_crossover_backend_func)(), /* Crossover backend function */
120 void (*p_mutation_manager_func)(), /* Mutation manager function */
121 void (*p_constraint_evaluation_func)(), /* Detects invalid ("lethal") children */
122 void (*p_patricide_func)(), /* Patricide function */
123 double *(*p_labelled_point_generator)(), /* External random point generator function */
124 List *(*p_labelled_point_list_generator)(), /* External generator for whole labelled point lists */
125 int (*p_solution_comparator_func)(), /* Compares a genome to those in the extracted set for distance */
126 List *(*p_solution_comparator_2_func)(), /* Compares genome to genomes in list for cost func shape */
127 double (*p_solution_distance_func)(), /* Gives a (relative) measure of the distance between two pointlists */
128 double (*p_dotp)(), /* Dot product of vectors 1->2 and 1->3 */
129 void (*p_mon_func)(), /* Hook for external population monitor function */
130 List *(*p_es_manager_func)(), /* Manages entry into the extracted list */
131 void (*p_backup_func)() /* Function for auto backup of populations */
132 );
133 List *exhaustive_search_1D(void);
134 List *exhaustive_search_2D(void);
135 List *exhaustive_search_3D(void);
136 Match *genetic_algorithm(List *pop_list_in, List *ext_list_in, int no_iterations);
137
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142
143 #endif /* TINA_MATH_NUM_GENALG_HDR*/
144
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.