Changeset 121 for cpp/frams/genetics/oper_fx.h
- Timestamp:
- 02/08/14 06:00:41 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/oper_fx.h
r119 r121 1 // This file is a part of the Framsticks G enoFX library.2 // Copyright (C) 2002-201 1 Maciej Komosinski. See LICENSE.txt for details.1 // This file is a part of the Framsticks GDK. 2 // Copyright (C) 2002-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. 3 3 // Refer to http://www.framsticks.com/ for further information. 4 4 5 #ifndef _GENO_ FX_H_6 #define _GENO_ FX_H_5 #ifndef _GENO_OPERATORS_H_ 6 #define _GENO_OPERATORS_H_ 7 7 8 8 #include <common/nonstd.h> … … 49 49 50 50 When designing genetic operations on some representation, inherit your class 51 (for example Geno _fMy) from Geno_fx. Define some methods,51 (for example GenoOper_fMy) from GenoOperators. Define some methods, 52 52 like mutate(), in your class, to allow for evolution. 53 53 Ensure they have the same names and arguments as the corresponding … … 77 77 the available source on developmental encoding and f4 genotype format.*/ 78 78 79 class Geno _fx79 class GenoOperators 80 80 { 81 81 public: … … 84 84 SString name; ///<name of this set of genetic operators 85 85 char **mutation_method_names; ///<array of names for mutation methods. If initialized (by new char*[]), must have entries for each method index returned by mutate(geno,chg,METHOD). If initialized, it is automatically freed by this destructor. 86 Geno _fx() : par(empty_paramtab) {supported_format='x'; name="Default"; mutation_method_names=NULL; setDefaults();}86 GenoOperators() : par(empty_paramtab) {supported_format='x'; name="Default"; mutation_method_names=NULL; setDefaults();} 87 87 88 88 /**Used to perform initializations of Param parameters that are not handled by the Param itself … … 172 172 ///currently not used (similarity of two genotypes) 173 173 virtual float similarity(const char*,const char*) {return GENOPER_NOOPER;} 174 virtual ~Geno _fx() {if (mutation_method_names) {delete []mutation_method_names; mutation_method_names=NULL;}}174 virtual ~GenoOperators() {if (mutation_method_names) {delete []mutation_method_names; mutation_method_names=NULL;}} 175 175 // virtual char getFormat() {return 255;} //returns supported genotype format, for ex. '1' 176 176 // virtual int enabled() {return 1;} // should be enabled by default … … 178 178 /** \name Some helpful methods for you */ 179 179 //@{ 180 180 static int roulette(const double *probtab,const int count); ///<returns random index according to probabilities in the \e probtab table or -1 if all probs are zero. \e count is the number of elements in \e probtab. 181 181 static bool getMinMaxDef(ParamInterface *p,int propindex,double &mn,double &mx,double &def); ///<perhaps a more useful (higher-level) way to obtain min/max/def info for integer and double properties. Returns true if min/max/def was really available (otherwise it is just invented). 182 182 static int selectRandomProperty(Neuro* n); ///<selects random property (either 0-based extraproperty of Neuro or 100-based property of its NeuroClass). -1 if Neuro has no properties. … … 194 194 static void skipWS(char *&s); ///<advances pointer \e s skipping whitespaces. 195 195 static bool areAlike(char*,char*); ///<compares two text strings skipping whitespaces. Returns 1 when equal, 0 when different. 196 196 static char* strchrn0(const char *str,char ch); ///<like strchr, but does not find zero char in \e str. 197 197 static bool isNeuroClassName(const char firstchar); ///<determines if \e firstchar may start NeuroClass name. If not, it may start NeuroClass' (or Neuro's) property name. 198 198 //@} … … 216 216 217 217 #endif 218
Note: See TracChangeset
for help on using the changeset viewer.