Changeset 247 for cpp/frams/genetics
- Timestamp:
- 11/07/14 17:51:01 (10 years ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_general.cpp
r197 r247 593 593 594 594 595 int f4_Cell::addlink(f4_Cell * nfrom, double nw, longnt)595 int f4_Cell::addlink(f4_Cell * nfrom, double nw, int nt) 596 596 { 597 597 if (nolink >= MAXINPUTS - 1) return -1; // full! … … 675 675 676 676 677 f4_CellLink::f4_CellLink(f4_Cell * nfrom, double nw, longnt)677 f4_CellLink::f4_CellLink(f4_Cell * nfrom, double nw, int nt) 678 678 { 679 679 from = nfrom; … … 1234 1234 int i, j, t, res; 1235 1235 char tc1, tc2; 1236 longrelfrom;1236 int relfrom; 1237 1237 double w; 1238 1238 unsigned gpos, oldpos; -
cpp/frams/genetics/f4/f4_general.h
r197 r247 101 101 int onestep(); // execute one simulation step (till a division) 102 102 103 int addlink(f4_Cell * nfrom, double nw, longnt);103 int addlink(f4_Cell * nfrom, double nw, int nt); 104 104 void adjustRec(); 105 105 … … 129 129 //f4_OrientMat OM; 130 130 double mz; // freedom in z 131 longp2_refno; // number of last end part object, used in f0132 longjoint_refno; // number of the joint object, used in f0133 longneuro_refno; // number of the neuro object, used in f0134 135 longctrl; // neuron type131 int p2_refno; // number of last end part object, used in f0 132 int joint_refno; // number of the joint object, used in f0 133 int neuro_refno; // number of the neuro object, used in f0 134 135 int ctrl; // neuron type 136 136 double state; 137 137 double inertia; … … 147 147 { 148 148 public: 149 f4_CellLink(f4_Cell * nfrom, double nw, longnt);149 f4_CellLink(f4_Cell * nfrom, double nw, int nt); 150 150 f4_Cell * from; 151 151 // type: 0: input, 1 '*', 2 'G', 3 'T', 4 'S' 152 longt;152 int t; 153 153 double w; 154 154 }; … … 205 205 int pos; // original position in string 206 206 int i1; // internal int parameter1 207 longl1; // internal long parameter1207 int l1; // internal long parameter1 208 208 double f1; // internal double parameter1 209 209 -
cpp/frams/genetics/f4/oper_f4.cpp
r199 r247 606 606 607 607 608 u nsigned longGeno_f4::style(const char *g, int pos)608 uint32_t Geno_f4::style(const char *g, int pos) 609 609 { 610 610 char ch = g[pos]; … … 616 616 if (!strchr(STYL4CAT_MODIFIC STYL4CAT_NEUMOD STYL4CAT_DIGIT STYL4CAT_REST, ch)) 617 617 return GENSTYLE_CS(0, GENSTYLE_INVALID); 618 u nsigned longstyle = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below618 uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below 619 619 if (strchr("X ", ch)) style = GENSTYLE_CS(0, GENSTYLE_NONE); 620 620 if (strchr("N", ch)) style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_NONE); -
cpp/frams/genetics/f4/oper_f4.h
r197 r247 38 38 int crossOver(char *&g1, char *&g2, float& chg1, float& chg2); 39 39 const char* getSimplest() { return "X"; } 40 u nsigned longstyle(const char *g, int pos);40 uint32_t style(const char *g, int pos); 41 41 42 42 // mutation probabilities -
cpp/frams/genetics/f9/oper_f9.cpp
r197 r247 109 109 110 110 ///Applying some colors and font styles... 111 u nsigned longGenoOper_f9::style(const char *g, int pos)111 uint32_t GenoOper_f9::style(const char *g, int pos) 112 112 { 113 113 char ch = g[pos]; 114 u nsigned longstyle = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below114 uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below 115 115 char *ptr = strchr((char*)turtle_commands_f9, ch); 116 116 if (ptr) -
cpp/frams/genetics/f9/oper_f9.h
r197 r247 17 17 int mutate(char *&g,float& chg,int &method); 18 18 int crossOver(char *&g1,char *&g2,float& chg1,float& chg2); 19 u nsigned longstyle(const char *g, int pos);19 uint32_t style(const char *g, int pos); 20 20 const char* getSimplest() {return "R";} 21 21 -
cpp/frams/genetics/fF/oper_fF.cpp
r197 r247 89 89 90 90 ///Applying some colors and font styles... 91 u nsigned longGenoOper_fF::style(const char *g, int pos)91 uint32_t GenoOper_fF::style(const char *g, int pos) 92 92 { 93 93 char ch = g[pos]; 94 u nsigned longstyle = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below94 uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below 95 95 if (strchr("-.e 0123456789", ch) != NULL) 96 96 style = GENSTYLE_CS(GENCOLOR_NUMBER, GENSTYLE_NONE); -
cpp/frams/genetics/fF/oper_fF.h
r197 r247 17 17 int mutate(char *&g, float& chg, int &method); 18 18 int crossOver(char *&g1, char *&g2, float& chg1, float& chg2); 19 u nsigned longstyle(const char *g, int pos);19 uint32_t style(const char *g, int pos); 20 20 const char* getSimplest() { return "6, 1.05, 1.05, 1.05, 0, 0, 0"; } 21 21 -
cpp/frams/genetics/fT/oper_fTest.cpp
r194 r247 115 115 116 116 ///Applying some colors and font styles... 117 u nsigned longGenoOper_fTest::style(const char *g, int pos)117 uint32_t GenoOper_fTest::style(const char *g, int pos) 118 118 { 119 119 char ch = g[pos]; 120 u nsigned longstyle = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below120 uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below 121 121 if (ch == 'A') style = GENSTYLE_RGBS(200, 0, 0, GENSTYLE_BOLD); 122 122 if (ch == 'T') style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_BOLD); -
cpp/frams/genetics/fT/oper_fTest.h
r194 r247 29 29 int mutate(char *&geno, float& chg, int &method); 30 30 int crossOver(char *&g1, char *&g2, float& chg1, float& chg2); 31 u nsigned longstyle(const char *g, int pos);31 uint32_t style(const char *g, int pos); 32 32 const char* getSimplest() { return "GATCGATTACA"; } 33 33 -
cpp/frams/genetics/genman.cpp
r240 r247 371 371 } 372 372 373 u nsigned longGenMan::Style(const char *g, int pos)373 uint32_t GenMan::Style(const char *g, int pos) 374 374 { 375 375 Geno G(g); … … 380 380 } 381 381 382 void GenMan::GetFullStyle(const char *g, u nsigned long*styletab)382 void GenMan::GetFullStyle(const char *g, uint32_t *styletab) 383 383 { 384 384 Geno G(g); … … 404 404 int chars = 0, lines = 0; 405 405 bool shortened = false; 406 u nsigned long *styletab = new unsigned long[len];406 uint32_t *styletab = new uint32_t[len]; 407 407 GetFullStyle(g, styletab); 408 408 SString html = "\n<div style=\"background:white;padding:0.2em;font-family:arial,helvetica,sans-serif;font-size:90%\">"; 409 u nsigned longprevstyle, prevcolor, style = 0, color = 0;409 uint32_t prevstyle, prevcolor, style = 0, color = 0; 410 410 for (int i = 0; i<len; i++) 411 411 { … … 501 501 } 502 502 503 void GenMan::onDelGen(void *obj, longn)503 void GenMan::onDelGen(void *obj, intptr_t n) 504 504 { 505 505 //old code needs update: -
cpp/frams/genetics/genman.h
r197 r247 46 46 Geno CrossOver(const Geno&, const Geno&); //returns xover genotype ("child") or empty if errors 47 47 float Similarity(const Geno&, const Geno&); //returns GENOPER_NOOPER or normalized similarity (1: identical, 0: different) 48 u nsigned longStyle(const char* g, int pos); //returns Style (and validity) of a genotype char.49 void GetFullStyle(const char *g, u nsigned long*styletab); //optimized. Fills styletab with styles for all genotype chars. sizeof(*styletab) must be at least strlen(g).48 uint32_t Style(const char* g, int pos); //returns Style (and validity) of a genotype char. 49 void GetFullStyle(const char *g, uint32_t *styletab); //optimized. Fills styletab with styles for all genotype chars. sizeof(*styletab) must be at least strlen(g). 50 50 SString HTMLize(const char *g); //returns colored genotype in HTML. 51 51 SString HTMLizeShort(const char *g); //returns colored genotype (abbreviated if needed) in HTML. … … 83 83 #undef STATRICKCLASS 84 84 void clearStats(); 85 static void onDelGen(void*, long);85 static void onDelGen(void*, intptr_t); 86 86 }; 87 87 -
cpp/frams/genetics/genoconv.h
r197 r247 46 46 out_format; //< output format, eg. '0' 47 47 const char *info; //< detailed info about converter, format or copyright 48 longenabled; //< don't touch this! (used by configuration module)49 longmapsupport; //< set to 1 if your converter supports genotype mapping48 paInt enabled; //< don't touch this! (used by configuration module) 49 paInt mapsupport; //< set to 1 if your converter supports genotype mapping 50 50 51 51 /// You have to reimplement this method. -
cpp/frams/genetics/oper_fx.cpp
r197 r247 58 58 if (p->type(i)[0] == 'd') 59 59 { 60 long_mn = 0, _mx = 1, _def = 0;60 paInt _mn = 0, _mx = 1, _def = 0; 61 61 defined = p->getMinMax(i, _mn, _mx, _def); 62 62 if (defined == 1) _mx = _mn + 1; … … 150 150 void GenoOperators::setIntFromDoubleWithProbabilisticDithering(ParamInterface &p, int index, double value) //TODO 151 151 { 152 p.setInt(index, value); //TODO value=2.5 will result in 2 but we want it to be 2 or 3 with equal probability. value=2.1 would be mostly 2, rarely 3. Careful with negative values (test it!)152 p.setInt(index, (paInt)value); //TODO value=2.5 will result in 2 but we want it to be 2 or 3 with equal probability. value=2.1 would be mostly 2, rarely 3. Careful with negative values (test it!) 153 153 } 154 154 … … 187 187 NeuroClass* GenoOperators::parseNeuroClass(char*& s) 188 188 { 189 int len = strlen(s);189 int len = (int)strlen(s); 190 190 int Len = 0; 191 191 NeuroClass *I = NULL; … … 193 193 { 194 194 const char *n = Neuro::getClass(i)->name; 195 int l = strlen(n);195 int l = (int)strlen(n); 196 196 if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = Neuro::getClass(i); Len = l; } 197 197 } … … 210 210 int GenoOperators::neuroClassProp(char*& s, NeuroClass *nc, bool also_v1_N_props) 211 211 { 212 int len = strlen(s);212 int len = (int)strlen(s); 213 213 int Len = 0, I = -1; 214 214 if (nc) … … 218 218 { 219 219 const char *n = p.id(i); 220 int l = strlen(n);220 int l = (int)strlen(n); 221 221 if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; } 222 222 if (also_v1_N_props) //recognize old properties symbols /=! … … 225 225 if (strcmp(n, "in") == 0) n = "="; else 226 226 if (strcmp(n, "fo") == 0) n = "!"; 227 l = strlen(n);227 l = (int)strlen(n); 228 228 if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; } 229 229 } … … 235 235 { 236 236 const char *n = p.id(i); 237 int l = strlen(n);237 int l = (int)strlen(n); 238 238 if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = i; Len = l; } 239 239 } -
cpp/frams/genetics/oper_fx.h
r201 r247 31 31 /** \name other useful style/color macros */ 32 32 //@{ 33 #define GENRGB(r,g,b) ((u nsigned long)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))<<8))|(((unsigned long)(unsigned char)(b))<<16)))34 #define GENSTYLE_RGBS(r,g,b,s) ((u nsigned long)((unsigned char)s)<<24 | GENRGB(r,g,b))35 #define GENSTYLE_CS(rgb,s) ((u nsigned long)((unsigned char)s)<<24 | rgb)33 #define GENRGB(r,g,b) ((uint32_t)(((uint8_t)(r)|((uint16_t)((uint8_t)(g))<<8))|(((uint32_t)(uint8_t)(b))<<16))) 34 #define GENSTYLE_RGBS(r,g,b,s) ((uint32_t)((uint8_t)s)<<24 | GENRGB(r,g,b)) 35 #define GENSTYLE_CS(rgb,s) ((uint32_t)((uint8_t)s)<<24 | rgb) 36 36 37 37 #define GENGETSTYLE(style) ((style)>>24) … … 168 168 Assume white background. 169 169 \sa GENSTYLE_* macros, like GENSTYLE_BOLD*/ 170 virtual u nsigned longstyle(const char *geno,int pos) {return GENSTYLE_RGBS(0,0,0,GENSTYLE_NONE);}170 virtual uint32_t style(const char *geno,int pos) {return GENSTYLE_RGBS(0,0,0,GENSTYLE_NONE);} 171 171 172 172 ///currently not used (similarity of two genotypes)
Note: See TracChangeset
for help on using the changeset viewer.