00001 #ifndef PGA_H
00002 #define PGA_H
00003
00004 #include <gsl/gsl_rng.h>
00005
00006 #define NUM_PARAMS 13
00007 #define POP_SIZE 200
00008 #define GEN_SIZE 100
00009 #define MAX_PROCS 32
00010
00011 #define GIMME_CHILD 1
00012 #define GOT_FIT 2
00013 #define CHILD_UP 3
00014 #define CHILD_DOWN 4
00015
00016
00017
00018 struct individual
00019 {
00020 double params[NUM_PARAMS];
00021 double std_dev[NUM_PARAMS];
00022 double fitness;
00023 int wins;
00024 int created;
00025 int id;
00026 };
00027
00028 double err(double exp_data[], double modl_data[], size_t length);
00029
00030 double fitness_function(double params[]);
00031
00032 void initialize_pop(struct individual parents[], double p_min[], double p_max[], double initial_std_dev, gsl_rng *r);
00033
00034 void mutation(struct individual parents[], struct individual children[], int gen, gsl_rng *r);
00035
00036 void selection(struct individual parents[], struct individual children[], int competition_size, gsl_rng *r);
00037
00038 void independent_assortment(struct individual children[], gsl_rng * r);
00039
00040 int compare_individuals(const void *a, const void *b);
00041
00042 void local_search(struct individual *child, int rank);
00043
00044 double all_spike_fit(double modl_data[], int length);
00045
00046 double variable_winsize_acuracy(double modl_data[], int mdl_length, double exp_data[], int exp_length);
00047
00048 double matrix_fit(double modl_data[], size_t mdl_length, double exp_data[], size_t exp_length);
00049
00050 double sum_nearest_err(
00051 double modl_data[], size_t mdl_length,
00052 double exp_data[], size_t exp_length);
00053
00054 double spike_replace_fit(double modl_data[], int mdl_length, double exp_data[], int exp_length);
00055
00056 int load_pop(struct individual parents[]);
00057
00058 int load_bin_pop(int *gen, struct individual parents[], struct individual children[], int done_children[]);
00059
00060 void save_bin_pop(int *gen, struct individual parents[], struct individual children[], int done_children[]);
00061
00062 #endif