calc2.h

来自「标准的GP源代码,由Andy Singleton维护」· C头文件 代码 · 共 132 行

H
132
字号
#ifndef CALC_LIB#define CALC_LIB true// calc2.h   Include file for calc.cc etc with stack primitives// W. B. Langdon cs.bham.ac.uk 18 Apr 1997 based upon calc.h r1.11// version "$Revision: 1.1 $"//Modifications (in reverse order)// WBL 18 Apr 1997 Ensure compatible with current GPxxx framework,//                 rename div as divide to avoid name clash with //                 gcc/lib/gcc-lib/sparc-sun-solaris2.4/2.6.3/include/stdlib.h// WBL 10 Dec 1995 Use pareto fitness of all five trees plus cpu#define RPN true//compile with stack primitives#define KARP2 true#define TIMINGS true#ifndef KARP2#define ADF true#endif//#define BYREF true//#define VAR_TIMINGS true//#define TRACE_RUN true//#define ADF_CACHE true//#define STORE_FIT true//STORE_FIT requires MULTREE and TRACE// uniform argument and return type for "closure"typedef int retval;                                     //WBL for stack#define PARETO#define TEST_STATS true#define setmaxfit(xparams) max_fitness /*dummy nop*/// Support for multiple trees within one individual in pop WBL// Only tested with FASTEVAL so far#define MULTREE// keep and print genelogical trace info#define TRACE#ifdef KARP2#ifdef RPN#define NUM_TREES 5#else#define NUM_TREES 8#endif#else#ifdef RPN#define NUM_TREES 7#else#define NUM_TREES 8#endif#endif#define MAXTREEDEPTH 0#define NUM_OPERATIONS 5#define NUM_OTHERS 1#define num_pareto_components (NUM_OPERATIONS+NUM_OTHERS)#define num_ellite_pareto      NUM_OPERATIONS//#define pareto_fitness(x) &(x->hits[0])#define pareto_fitness(x,i) (x->hits[i])//#define pareto_fitness(x,i) scoretype(x->fvalue)#define store_limit 128#define Array_bot   (-63)#define Array_top   63//#define F_tan_spread 15.0#define max_iterates 128#define loop_max_depth MAXINT#define print_buffer_size 10inline float print_match_max_score   (int x) {return ((x==0)? 0.05 : 1.0);}inline float print_match_length_score(int x, int y) {#ifdef ORIGINAL_PRINT_MATCH	return ((x!=y)? 0.0 : (x==0)? 0.05 : 0.2);}#else	return ((x==0)? 0.05:0.2) * ((x==y)? 1.0:0.5/abs(x-y));}#endifinline float print_match_item_score  (int x) {return (0.4/(x));}inline float print_match_order_score (int x) {return (0.4/(x));}typedef int scoretype;#define mem_penalty_bot MAXINT#define cpu_penalty_bot 50#define MAX_BREAKS         1024#define NUM_TEST_SEQUENCES 1024#define NUM_TEST_PHASES    1#ifdef RPNenum{num,plus,minus,times,divide, adf1,adf2,adf3};#define first_op 0#define last_op  divide#elseenum{ans,num,plus,minus,times,divide,open,close};#define first_op ans#define last_op  close#endifextern const int  tree_arg_num     [last_op+1];extern const BOOL tree_return_value[last_op+1];//not actually problem dependant but keep include files a bit cleanerretval random_value(int& seed); //seed > 0extern      float max_fitness;extern      int end_gens(); //see if need to move to the next test phase                             //return <> 0 if wish to save a bench pointextern      num_sol_found; //for save and restore to dumpfile#ifdef KARP2#define STACK_PRIM true#endif//Restore original "rectangular deme" described in thesis#define ORIGINAL_DEME true#define DIRECTEDXOVER true//Restore original single "i0" without depth restriction described in thesis#define ORIGINAL_LOOP true#endif /*CALC_LIB*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?