⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 karp.h

📁 标准的GP源代码,由Andy Singleton维护
💻 H
字号:
#ifndef KARP_LIB#define KARP_LIB true// karp.h   Include file for brack.cc etc// W. B. Langdon cs.bham.ac.uk 17 Apr 1997// version "$Revision: 1.2 $"//Modifications (in reverse order)//WBL 17 Apr 1997  Created for Easter 1997 release from brack.h r1.10//                 Add KARP2, adf3 and NUM_TREES increased from 3 to 4//                 Remove TIMINGS and add ORIGINAL_DEME. To keep compiler//                 happy: add ORIGINAL_LOOP (even though loops are not used,//                 MAXTREEDEPTH, and dummy setmaxfit. //WBL 19 Nov 1995  Back to karp (ie no stack primitives)//WBL 31 Oct 1995  Restore for use without stack primitives,//                 Do conditional compilation stuff in this file//WBL 15 Oct 1995  Use TIMINGS and VAR_TIMINGS//                 and restore use of pareto fitness (with cpu)//WBL 22 Sep 1995  New file. Based of list.cc rev 1.30#define KARP true//#define KARP2 true --- not defined => use indexed memory//#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 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#define NUM_TREES 1#else#define NUM_TREES 4#endif#define MAXTREEDEPTH 0#define NUM_OPERATIONS 1#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         204800#define NUM_TEST_SEQUENCES 102400#define NUM_TEST_PHASES    1enum{rpb,adf1,adf2,adf3};#define first_op rpb#define last_op  rpbextern 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 /*KARP_LIB*/

⌨️ 快捷键说明

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