queue2.h
来自「标准的GP源代码,由Andy Singleton维护」· C头文件 代码 · 共 98 行
H
98 行
// queue.h Include file for queue2.cc stats.cc// W. Langdon cs.ucl.ac.uk 22 August 1994// version "$Revision: 1.9 $"// Includes main function//Modifications (in reverse order)//WBL 31 Mar 1997 Make compatible with GPxxx (though not intergrated with it)// Also compatible with DEC ALPHA C//WBL 25 Nov 1994 Add select_hits//WBL 22 Nov 1994 Add TreeNameMatch.// NB fixup for lost version not saved into RCS and lost today//WBL 8 Sep 1994 Add adf1//WBL 8 Sep 1994 Reduce mem_penalty_bot from 16 to 12,// Add static_check//WBL 31 Aug 1994 add AddF3//WBL 29 Aug 1994 add (cf queue.cc) mem_penalty_bot.//NB makenull must be first and empty last, see also const int[]//enum{makenull,top,pop,push,empty,start_test,end_tests};enum{makenull,front,dequeue,enqueue,empty,adf1,adf2,start_test,end_tests};#define mem_penalty_bot 12class myfitnessvalue : public FitnessValue {public: int hits [empty+1] /*= {0,0,0,0,0}*/; int mem_used /*= 0*/; int adf1 /*= 0*/; BOOL IsBetter(FitnessValue* fv); void write(ostream& fout = cout ); void Copy(FitnessValue* fv) {memcpy(this,fv,sizeof(myfitnessvalue));}// myfitnessvalue()//:FitnessValue//{//cout<<"myfitnessvalue::myfitnessvalue(); hits[4]="<<hits[4];//cout<<" fvalue="<<fvalue<<endl;//}; int dominates(myfitnessvalue* target);};//end class myfitnessvalue;typedef myfitnessvalue* ptrmyfitnessvalue;class mychrome : public Chrome {public: myfitnessvalue* nfitness; mychrome(ChromeParams* p,Problem* pr,Function** f,retval* c, istream* fil = NULL): Chrome(p,pr,f,c,TRUE,fil) {};};//end class mychromeclass queue : public Problem {public: queue(ChromeParams* p=NULL); // Initialize primitives, void WriteTreeName(int tree, ostream& ostr = cout ); // parameters, and data BOOL TreeNameMatch(int tree, char* s); float fitness(Chrome* chrome); // GP fitness function Chrome* NewChrome(ChromeParams* p, istream* fil = NULL ){//cout<<"queue::NewChrome\n";//debug return new mychrome(p,this,getfuncs(),getconsts()); }; FitnessValue* GetFitnessObj(Chrome* chrome = NULL) {//cout<<"queue::GetFitnessObj\n";//debug<return new myfitnessvalue;}; Chrome* queue::Bestof(const PtrChrome list[], const int listsize, int* bestinlist = NULL, const int target = 0 ); Chrome* queue::Worstof(const PtrChrome list[], const int listsize, const int timenow, int* worstinlist, const int target ); int static_check(Chrome* chrome, int tree); void AddF1 (int tree, Function* f ); void AddFbar1 (int exclude_tree, Function* f ); void AddF2 (int tree1, int tree2, Function* f ); void AddF3 (int tree1, int tree2, int tree3, Function* f ); void AddFmain (Function* f ); void AddFall (Function* f );};//end class queueChrome* select_hits (const PtrChrome list[], const int listsize, const int target, int* bestinlist, const BOOL best = TRUE, int* select = NULL, int* duplicates = NULL, int* select_size = NULL);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?