Changeset 957 for cpp/frams/genetics/genooperators.cpp
- Timestamp:
- 06/25/20 16:31:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/genooperators.cpp
r955 r957 76 76 } 77 77 78 int GenoOperators::selectRandomNeu Property(Neuro *n)78 int GenoOperators::selectRandomNeuronProperty(Neuro *n) 79 79 { 80 80 int neuext = n->extraProperties().getPropCount(), … … 82 82 if (neuext + neucls == 0) return -1; //no properties in this neuron 83 83 int index = rndUint(neuext + neucls); 84 if (index >= neuext) index = index - neuext + 100;84 if (index >= neuext) index = index - neuext + NEUROCLASS_PROP_OFFSET; 85 85 return index; 86 86 } 87 87 88 double GenoOperators::mutateNeu Property(double current, Neuro *n, int i)88 double GenoOperators::mutateNeuronProperty(double current, Neuro *n, int i) 89 89 { 90 90 if (i == -1) return mutateCreepNoLimit('f', current, 2, true); //i==-1: mutating weight of neural connection 91 91 Param p; 92 if (i >= 100) { i -= 100; p = n->getClass()->getProperties(); }92 if (i >= NEUROCLASS_PROP_OFFSET) { i -= NEUROCLASS_PROP_OFFSET; p = n->getClass()->getProperties(); } 93 93 else p = n->extraProperties(); 94 94 double newval = current; … … 354 354 const char *n = p.id(i); 355 355 int l = (int)strlen(n); 356 if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = 100+ i; Len = l; }356 if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = NEUROCLASS_PROP_OFFSET + i; Len = l; } 357 357 if (also_v1_N_props) //recognize old properties symbols /=! 358 358 { … … 361 361 if (strcmp(n, "fo") == 0) n = "!"; 362 362 l = (int)strlen(n); 363 if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = 100+ i; Len = l; }363 if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = NEUROCLASS_PROP_OFFSET + i; Len = l; } 364 364 } 365 365 }
Note: See TracChangeset
for help on using the changeset viewer.