00001 00002 #ifndef __STRATEGY_H__ 00003 #define __STRATEGY_H__ 00004 00006 // // 00007 // ----- _ ---- // 00008 // | / \ ( | ___ | ___ // 00009 // |--- / \ --- -+- |/\ ___| -+- / ) ___ \ | // 00010 // | |---| ) | | ( | | |--- ( \ \ | // 00011 // |____ | | ___/ \ | \__| \ \__ ---/ \_/ // 00012 // __/ \_/ // 00014 00015 // In olden times strategy was listed among the Ten Abilities and 00016 // Seven Arts as a beneficial practice. It was certainly an art but as 00017 // a beneficial practice it was not limited to sword-fencing. The true 00018 // value of sword-fencing cannot be seen within the confines of 00019 // sword-fencing technique. 00020 00028 class EAStrategy { 00029 public: 00030 00034 EAStrategy (SimplePopulation& popula); 00035 virtual ~EAStrategy () {delete mpNextGen;} 00036 00045 void evolve (EAEnvironment& envr, TextOStream& out, TextOStream& log); 00046 00049 virtual void addFeaturesTo (Genome& genome) const; 00050 00053 void print (TextOStream& out); 00054 00066 void recombine (const SelectionSituation& situation, 00067 const SelectionMatrix& selmat); 00068 00071 enum traceflags {TRACE_RECOMBINATION=10, TRACE_MUTATION}; 00072 00074 void check () const; 00075 00076 protected: 00078 SimplePopulation& mrPopula; 00079 00081 Array<Individual>* mpNextGen; 00082 00084 bool allow_same_parents; 00085 }; 00086 00087 00088 // 00089 // Timing in strategy 00090 // 00091 // There is timing in everything. Timing in strategy cannot be 00092 // mastered without a great deal of practice. 00093 // 00094 // Timing is important in dancing and pipe or string music, for they 00095 // are in rhythm only if timing is good. Timing and rhythm are also 00096 // involved in the military arts, shooting bows and guns, and riding 00097 // horses. In all skills and ablilities there is timing. 00098 // -- Miyamoto Musashi 00099 // 00100 00101 #endif 00102