00001 /**************************************************************************** 00002 00003 $Id: EGEnvironment.h,v 1.3 2002/11/08 03:47:38 motegi Exp $ 00004 Copyright (C) 2002 Higuchi Lab. All rights reserved. 00005 00006 *****************************************************************************/ 00007 #ifndef INCLUDE__ENVIRONMENT_H__FILE 00008 #define INCLUDE__ENVIRONMENT_H__FILE 00009 00010 #include "defs.h" 00011 #include <iosfwd> 00012 #include <string> 00013 00017 class EGEnvironment { 00018 public: 00019 static EGEnvironment& Instance(); 00020 00021 void NextGeneration(); 00022 void Display(std::ostream&) const; 00023 void SaveEnvironment() const; 00024 void LoadEnvironment(); 00025 00026 UInt PopSize() const { return PopSize_; } 00027 UInt NumIn() const { return NumIn_; } 00028 UInt NumOut() const { return NumOut_; } 00029 UInt SubGraphSize() const { return SubGraphSize_; } 00030 UInt MaxNodeSize() const { return MaxNodeSize_; } 00031 Float CrossoverRate() const { return CrossoverRate_; } 00032 Float MutationRate() const { return MutationRate_; } 00033 UInt MaxGeneration() const { return MaxGeneration_; } 00034 UInt CurrentGeneration() const { return CurrentGeneration_; } 00035 std::string WorkDir() const { return WorkDir_; } 00036 bool GenerateDot() const { return GenerateDot_; } 00037 bool GeneratePopLog() const { return GeneratePopLog_; } 00038 std::string Input() const { return Input_; } 00039 bool GenerateTimeLog() const { return GenerateTimeLog_; } 00040 bool GenerateFitnessLog() const { return GenerateFitnessLog_; } 00041 bool GenerateBestLog() const { return GenerateBestLog_; } 00042 bool GeneratePopSave() const { return GeneratePopSave_; } 00043 bool GenerateEachGeneration() const { return GenerateEachGeneration_; } 00044 00045 void SetPopSize(UInt n) { PopSize_ = n; } 00046 void SetNumIn(UInt n) { NumIn_ = n; } 00047 void SetNumOut(UInt n) { NumOut_ = n; } 00048 void SetSubGraphSize(UInt n) { SubGraphSize_ = n; } 00049 void SetMaxNodeSize(UInt n) { MaxNodeSize_ = n; } 00050 void SetCrossoverRate(Float f) { CrossoverRate_ = f; } 00051 void SetMutationRate(Float f) { MutationRate_ = f; } 00052 void SetMaxGeneration(UInt n) { MaxGeneration_ = n; } 00053 void SetWorkDir(std::string s) { WorkDir_ = s; } 00054 void SetGenerateDot(bool b) { GenerateDot_ = b; } 00055 void SetGeneratePopLog(bool b) { GeneratePopLog_ = b; } 00056 void SetInput(std::string s) { Input_ = s; } 00057 void SetGenerateTimeLog(bool b) { GenerateTimeLog_ = b; } 00058 void SetGenerateFitnessLog(bool b) { GenerateFitnessLog_ = b; } 00059 void SetGenerateBestLog(bool b) { GenerateBestLog_ = b; } 00060 void SetGeneratePopSave(bool b) { GeneratePopSave_ = b; } 00061 void SetGenerateEachGeneration(bool b) { GenerateEachGeneration_ = b; } 00062 00063 EGEnvironment(); 00064 ~EGEnvironment() { } 00065 00066 private: 00067 EGEnvironment(const EGEnvironment&); 00068 EGEnvironment& operator=(const EGEnvironment&); 00069 00070 // Main parameters 00071 UInt PopSize_; 00072 UInt NumIn_; 00073 UInt NumOut_; 00074 UInt SubGraphSize_; 00075 UInt MaxNodeSize_; 00076 Float CrossoverRate_; 00077 Float MutationRate_; 00078 UInt MaxGeneration_; 00079 00080 00081 UInt CurrentGeneration_; 00082 std::string WorkDir_; 00083 bool GenerateDot_; 00084 bool GeneratePopLog_; 00085 std::string Input_; 00086 bool GenerateTimeLog_; 00087 bool GenerateFitnessLog_; 00088 bool GenerateBestLog_; 00089 bool GeneratePopSave_; 00090 bool GenerateEachGeneration_; 00091 }; 00092 00093 #endif //INCLUDE__ENVIRONMENT_H__FILE