📄 gp.h
字号:
#define _skip_subtree(br) br->ind->index_ptr = br->tree[br->ind->index_ptr].jump#define MAXSTRING 100typedef unsigned char Snode;typedef struct fast_node { int opcode; int jump; } Fnode; typedef struct fte { int arity; int macro; int constant; int weight; GTYPE (*code) P_(( )); /*char *print_name;*/ char print_name[50];} FunctionTableEntry; typedef struct fast_branch { int branchnum; int num_nodes; Fnode * tree; struct ind * ind; int function_vector[TOTAL_NUMBER_OF_FUNCTIONS]; } Branch;typedef struct ind { Branch rpbs[_max(1,NUM_RPBS)]; Branch adfs[_max(1,MAX_NUM_ADFS)]; int current_number_of_adfs; float s_fitness; int adf_arity[_max(1,MAX_NUM_ADFS)]; int hits; float beauty; Fnode code[MAX_NUM_NODES_PER_DUDE]; int index_ptr; #if (USE_MULTI_TYPED_ADFS) int adf_type[_max(1,MAX_NUM_ADFS)]; #endif } Individual; /* Structure for an Individual */typedef struct small_ind { #if (USE_MULTI_TYPED_ADFS) signed char adf_type[_max(1,MAX_NUM_ADFS)]; #endif signed char current_number_of_adfs; float s_fitness; int hits; float beauty; #if (POINT_TYPING) signed char function_vector[MAX_NUM_ADFS + NUM_RPBS][_max(1,MAX_NUM_ADFS + MAX_NUM_ADF_ARGS)]; #endif Snode code[MAX_NUM_NODES_PER_DUDE]; int usage; struct small_ind * forward; struct small_ind * backward; struct repro * op_list; } CompInd;typedef struct pinformation { int num_parents; int parents[MAX_NUM_NODES_PER_DUDE/2]; int branches[MAX_NUM_NODES_PER_DUDE/2]; } ParentInfo;typedef struct repro { /*short*/ int repro_op_type; int parent1; int parent2; int brnum1; int brnum2; /*could be removed*/ int point1; struct repro * next_for_parent1; struct repro * next_for_parent2; } ReproOpInfo;typedef struct { GTYPE g_arg[MAX_NUM_ARGS]; } PopGlobals;typedef struct start_msg { int num_nodes; /* -- should this be in the default.in file or gleaned from the cfs script? */ int num_individuals; int num_generations; int run_num; char problem[20]; int max_new_tree_depth; int max_depth_for_mutation; int num_primed_individuals; float crossover_fraction_for_leaves; float crossover_fraction_for_node; float mutation_fraction; float copy_fraction; float branch_creation_fraction; float branch_duplication_fraction; float branch_deletion_fraction; float arg_duplication_fraction; float arg_deletion_fraction; float arg_creation_fraction; float early_crossover_fraction_for_leaves; float early_crossover_fraction_for_node; float early_mutation_fraction; float early_copy_fraction; float early_branch_creation_fraction; float early_branch_duplication_fraction; float early_branch_deletion_fraction; float early_arg_duplication_fraction; float early_arg_deletion_fraction; float early_arg_creation_fraction; #if (USE_IPBCO || USE_ITERATION_GROUP_CREATION) float early_ipbco_fraction; float ipbco_fraction; #endif int growth_method; /* RAMPED, FULL, or GROWTH */ int as_if_number; long perpetual_number; long fit_case_seed; long seed; GTYPE random_constant_table[MAXNUMFUNCTIONS]; Individual primed_individual; /*Can Add Additional Flags (and the code to deal with them in both the boss and breeder, as desired. */ /*These may want to end up being set by the default.in file, perhaps?*/ /*At the moment a function on the boss called (set-bn-debug flags*/ /*will suffice*/ } StartupInfo;typedef struct hist { int histogram[NUM_BUCKETS]; } HistogramInfo;typedef struct psi { int extra_ints[NUM_EXTRA_SLOTS]; float extra_floats[NUM_EXTRA_SLOTS]; #if (USER_EXTRA_BEST_INFO) UserExtraInfo user_extra_info[NUM_EXTRA_SLOTS]; #endif } ExtraBestDudeInfo;typedef struct eog_msg { Individual ind; Individual spec_ind; float out_fitness; float out_beauty; int out_hits; int spec_ind_flag; int gen; int out_flag; float best_fitness; int best_hits; float worst_fitness; int worst_hits; float average_fitness; int average_hits; float variance_of_fitness; float variance_of_hits; ExtraBestDudeInfo best_extra; float delta_avf;#if (HISTOGRAMS) HistogramInfo histogram;#endif int ps_count; /*Maybe add the histogram?*/ } EndGenInfo;typedef struct eureka { Individual ind; int gen; ExtraBestDudeInfo best_extra; } EurekaInfo;typedef struct text_string { char buf[500]; } TextInfo;typedef struct constraint { int children[TOTAL_NUMBER_OF_FUNCTIONS]; } ConstraintInfo;typedef struct pop{ char problem[20]; int num_nodes; int pop_size; CompInd * members; CompInd * free1; CompInd * free2; ReproOpInfo * repro_op_list; CompInd * free_list; CompInd * one_list; CompInd * two_list; CompInd * more_list; CompInd childx1; CompInd childx2; Individual parent1; Individual parent2; Individual tempind; int * culled_population; int number_in_culled_pop; Individual best_so_far; Individual best_out_so_far; char outfilename[50]; int best_of_run_num; int best_dude_index; ExtraBestDudeInfo temp_extra; ExtraBestDudeInfo best_extra; ExtraBestDudeInfo out_sample_extra; float best_fitness; float best_out_fitness; FunctionTableEntry func_table[MAXNUMFUNCTIONS]; int num_general_functions; int num_functions[NUM_RPBS+MAX_NUM_ADFS]; int function_assignment[NUM_RPBS+MAX_NUM_ADFS][MAXNUMFUNCTIONS]; char read_files[NUM_RPBS+MAX_NUM_ADFS][MAXSTRING]; GTYPE constants[MAXNUMFUNCTIONS]; int brstart[NUM_RPBS+MAX_NUM_ADFS]; int brend[NUM_RPBS+MAX_NUM_ADFS]; int brsize[NUM_RPBS+MAX_NUM_ADFS]; int brweight[NUM_RPBS+MAX_NUM_ADFS]; int num_constants; int primed_constants; FILE * out_file; int emigrants[MAX_NUM_EMIGRANTS_PER_GENERATION]; int num_emigrants; int num_immigrants; float last_avf; StartupInfo pop_startup_info; PopGlobals pop_globals; EndGenInfo pop_eog; EurekaInfo pop_eureka; ConstraintInfo con_parents[TOTAL_NUMBER_OF_FUNCTIONS+1]; int new_best; } Population; /* Structure for a Population */#ifdef _ICCtypedef struct { char problem[20]; int run_number; char start_time[256]; int rows; int cols; int num_meshnodes; int num_gens_to_graph; int max_hits; float best_fitness; float max_fitness; int highest_gen_so_far; int better_hits_alert;#if (HISTOGRAMS) HistogramInfo overall_histogram; /*single histogram*/ HistogramInfo * node_histograms; /*array N = num_meshnodes*/#endif int * gen_of_each_node; /*array N = num_meshnodes*/ int * status_of_each_node; /*array N = num_meshnodes*/ int * hits_of_each_node; /*array N = num_meshnodes*/ int * time_of_last_report; /*array N = num_meshnodes*/ float * fit_of_each_node; /*array N = num_meshnodes*/ int * best_hits_of_each_gen; /*array N = num_gens*/ float * best_fit_of_each_gen; /*array N = num_gens*/ }GraphicInfo; /*Structure providing info for graphing on transputer machine*/#endif#include "gpshared.h"#include "prbproto.h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -