📄 gamanager.h
字号:
/*************************************************************************** gamanager.h - description ------------------- begin : Sat Feb 16 2002 copyright : (C) 2002 by R黡iger Koch email : rkoch@rkoch.org ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#ifndef GAMANAGER_H#define GAMANAGER_Husing namespace std;#include <amygdala/network.h>#include <amygdala/genome.h>#include <string>/**@class GAManager gamanager.h amygdala/gamanager.h *Encapsulates the handling of new phenotypes *@author R黡iger Koch */class GAManager {public: GAManager(); virtual ~GAManager(); void Run(AmTimeInt maxSimTime, AmTimeInt maxRunTime); /** A derived class must implement this function to return the score */ virtual unsigned int GetScore() = 0; /** Set up the GA A derived class has to implement this class */ virtual void Setup(string uri) = 0; /** Fork a new child for each generation. We do this to avoid trouble with * mem leaks, Amygdala initialization... Let the OS clean things up. */ int Loop(string uri, AmTimeInt maxSimTime, AmTimeInt maxRunTime); /** return the network, simply to get hold of simTime */ Network* getNetwork(); /** If we load from a file the genome doesn't get the format of the genome. Here we can supply it. */ void GenomeFormat( string format);protected: // Protected attributes /** the network */ Network* NN; Genome *genome; static bool run; static bool isManager; static GAManager *theGAManager;protected: // Protected methods /** return the results of the simulation */ void finalize();private: // Private methods /** The handler function to catch a SIGALRM */ static void timeout(int signum); /** The handler function to catch a SIGINT or a SIGHUP */ static void simStop(int signum);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -