Changeset 773 for cpp/frams/genetics/f4
- Timestamp:
- 04/05/18 23:14:35 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/oper_f4.cpp
r772 r773 186 186 if (g->ordNode(i) == n3) 187 187 { 188 neuronid = neulist.size() -1;188 neuronid = neulist.size() - 1; 189 189 } 190 190 } … … 236 236 if (gcur == par) 237 237 { 238 neuronid = neulist.size() -1;238 neuronid = neulist.size() - 1; 239 239 } 240 240 } … … 395 395 if (gcur == n1) 396 396 { 397 neuronid = neulist.size() -1;397 neuronid = neulist.size() - 1; 398 398 } 399 399 } … … 434 434 { 435 435 // '*', 'G', 'T', or 'S', 1/4 chance each 436 nc = 436 nc = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(); 437 437 } 438 438 if (nc != NULL) … … 451 451 } 452 452 // weight 453 nn->f1 = GenoOperators::mutateNeuProperty(nn->f1, NULL,-1);453 nn->f1 = GenoOperators::mutateNeuProperty(nn->f1, NULL, -1); 454 454 //nn->f1 = 10.0f * (rnd01 - 0.5f); 455 455 } … … 485 485 nn->l1 = neuid - id; 486 486 } 487 487 //nn->l1 += (int)(2.0f * (rnd01 - 0.5f)); 488 488 break; 489 489 case 2: // change weight 490 nn->f1 = GenoOperators::mutateNeuProperty(nn->f1, NULL,-1);490 nn->f1 = GenoOperators::mutateNeuProperty(nn->f1, NULL, -1); 491 491 //nn->f1 += 1.0f * (rnd01 - 0.5f); 492 492 break; … … 717 717 { 718 718 char ch = g[pos]; 719 719 720 // style categories 720 721 #define STYL4CAT_MODIFIC F14_MODIFIERS "," 721 #define STYL4CAT_NEUMOD "[]|@*GTS:+-/!=" 722 #define STYL4CAT_NEUMOD "[]:+-/!=" 723 #define STYL4CAT_NEUSPECIAL "|@*" 722 724 #define STYL4CAT_DIGIT "0123456789." 723 725 #define STYL4CAT_REST "XN<># " 724 726 725 if (!isalpha(ch) && !isdigit(ch) && !strchr("<>-+[]:,.@|#*/=!\t",ch)) { 727 if (!isalpha(ch) && !strchr(STYL4CAT_MODIFIC STYL4CAT_NEUMOD STYL4CAT_NEUSPECIAL STYL4CAT_DIGIT STYL4CAT_REST "\t", ch)) 728 { 726 729 return GENSTYLE_CS(0, GENSTYLE_INVALID); 727 730 } 728 731 uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below 729 if (strchr("X ", ch)) style = GENSTYLE_CS(0, GENSTYLE_NONE);730 else if (strchr("N", ch)) style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_NONE);731 else if (strchr("<", ch)) style = GENSTYLE_RGBS(0, 0, 200, GENSTYLE_BOLD);732 else if (strchr(">", ch)) style = GENSTYLE_RGBS(0, 0, 100, GENSTYLE_NONE);732 if (strchr("X ", ch)) style = GENSTYLE_CS(0, GENSTYLE_NONE); 733 else if (strchr("N", ch)) style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_NONE); 734 else if (strchr("<", ch)) style = GENSTYLE_RGBS(0, 0, 200, GENSTYLE_BOLD); 735 else if (strchr(">", ch)) style = GENSTYLE_RGBS(0, 0, 100, GENSTYLE_NONE); 733 736 else if (strchr(STYL4CAT_DIGIT, ch)) style = GENSTYLE_RGBS(100, 100, 100, GENSTYLE_NONE); 734 737 else if (strchr(STYL4CAT_MODIFIC, ch)) style = GENSTYLE_RGBS(100, 100, 100, GENSTYLE_NONE); 735 738 else if (strchr(STYL4CAT_NEUMOD, ch)) style = GENSTYLE_RGBS(0, 150, 0, GENSTYLE_NONE); 736 else if (isalpha(ch)) {737 int p = pos;738 while (p > 0) {739 p--;740 if (!isalpha(g[p])) {741 if (isupper(g[p+1]) && (g[p] == ':' || g[p] == '[')) { // name of neuron class742 style = GENSTYLE_RGBS(150,0,150,GENSTYLE_ITALIC);743 }744 else { // property745 style = GENSTYLE_RGBS(255,140,0,GENSTYLE_BOLD);746 }739 if (isalpha(ch) || strchr(STYL4CAT_NEUSPECIAL, ch)) 740 { 741 while (pos > 0) 742 { 743 pos--; 744 if (!(isalpha(g[pos]) || strchr(STYL4CAT_NEUSPECIAL, ch))) 745 { 746 if (isupper(g[pos + 1]) && (g[pos] == ':' || g[pos] == '[')) // name of neuron class 747 style = GENSTYLE_RGBS(150, 0, 150, GENSTYLE_ITALIC); 748 else // property 749 style = GENSTYLE_RGBS(100, 100, 100, GENSTYLE_NONE); 747 750 } 748 751 }
Note: See TracChangeset
for help on using the changeset viewer.