trace.cc

来自「标准的GP源代码,由Andy Singleton维护」· CC 代码 · 共 87 行

CC
87
字号
// time.h   // W.Langdon@cs.ucl.ac.uk $Revision: 1.5 $ 2 May 1995//Modifications (reverse order)://WBL  7 May 95 Remove caches. Since 1) this may not be unique (ie new may //              reuse same address for another myfitnessvalue) and 2) changes//              to ChooseCrossTree make cache hits infrequent. #include <assert.h>#include "pch.h"#include "chrome.h"#include "trace.h"#include "list.h"#include "Primitives.h"#include "gp.h"ostream& operator<<(ostream& os,trace_run& tr){int t;//os<<"tree_used ";//for(t=0;t<NUM_TREES;t++) {//	os<<tr.tree_used[t]<<"\t";//}//os<<endl;os<<"tree_ok   ";for(t=0;t<NUM_TREES;t++) {	char buf[80]; sprintf(buf,"%4d",tr.tree_ok[t]);        os << buf;}os<<endl;os<<"tree_nak  ";for(t=0;t<NUM_TREES;t++) {	char buf[80]; sprintf(buf,"%4d",tr.tree_nak[t]);        os << buf;}os<<endl;return os;}//end <<class cache {	void* tag;// = NULL;	int value;	cache(): tag(NULL){}; public:inline	BOOL present(void* t, int& v) const {	v = value; //whether crsap or not        return (t==tag);};inline	void    save(void* t, int v) {	tag = t;	value = v;};};//end class cache;//static cache ok_ [NUM_TREES];//static cache nak_[NUM_TREES];int myfitnessvalue::ok(int tree) const {int answer;//if (!ok_[tree].present(this,answer)) {	answer = 0;	for(int s=0; s<NUM_TEST_SEQUENCES;s++) {		answer += test_data[s].trace.unpack_ok(tree); }//	ok_[tree].save(this,answer);//      }return answer;}int myfitnessvalue::nak(int tree) const {int answer;//if (!nak_[tree].present(this,answer)) {	answer = 0;	for(int s=0; s<NUM_TEST_SEQUENCES;s++) {		answer += test_data[s].trace.unpack_nak(tree); }//	nak_[tree].save(this,answer);//	}return answer;}

⌨️ 快捷键说明

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