- Timestamp:
- 03/29/24 23:30:34 (9 months ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_oper.cpp
r1274 r1298 253 253 return GENOPER_OPFAIL; 254 254 255 node_mutated = candidate_nodes[rndUint( (unsigned int)candidate_nodes.size())];255 node_mutated = candidate_nodes[rndUint(candidate_nodes.size())]; 256 256 f4_Node *node_mutated_parent = node_mutated->parent; 257 257 -
cpp/frams/genetics/fB/fB_oper.cpp
r1273 r1298 252 252 { 253 253 std::list<SString> tokenized = tokenizeSequence(line); 254 int rndid = rndUint( (int)tokenized.size()); // select random letter from genotype254 int rndid = rndUint(tokenized.size()); // select random letter from genotype 255 255 // increment/decrement character - when overflow happens, this method 256 256 // uses the "reflect" approach … … 291 291 std::list<SString> tokenized = tokenizeSequence(line); 292 292 std::list<SString>::iterator it = tokenized.begin(); 293 int rndid = rndUint( (int)tokenized.size()); // select random insertion point293 int rndid = rndUint(tokenized.size()); // select random insertion point 294 294 std::advance(it, rndid); 295 295 NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); … … 312 312 chg = 1.0 / line.length(); 313 313 std::list<SString> tokenized = tokenizeSequence(line); 314 int rndid = rndUint( (int)tokenized.size()); // select random insertion point314 int rndid = rndUint(tokenized.size()); // select random insertion point 315 315 std::list<SString>::iterator it = tokenized.begin(); 316 316 std::advance(it, rndid); … … 326 326 std::list<SString> tokenized = tokenizeSequence(line); 327 327 std::list<SString>::iterator it = tokenized.begin(); 328 int rndid = rndUint( (int)tokenized.size()); // select random deletion point328 int rndid = rndUint(tokenized.size()); // select random deletion point 329 329 std::advance(it, rndid); 330 330 tokenized.erase(it); … … 348 348 for (int i = 0; i < 4; i++) 349 349 { 350 cuts[i] = rndUint( (int)tokenized.size());350 cuts[i] = rndUint(tokenized.size()); 351 351 } 352 352 std::sort(cuts.begin(), cuts.end()); -
cpp/frams/genetics/fF/fF_oper.cpp
r1280 r1298 49 49 par.load(gene); 50 50 static const int propsToMutate[] = fF_PROPS_TO_MUTATE; 51 int which = rndUint( (unsigned int)std::size(propsToMutate));51 int which = rndUint(std::size(propsToMutate)); 52 52 bool mutated_ok = GenoOperators::mutatePropertyNaive(par.param, propsToMutate[which]); 53 53 if (mutated_ok) -
cpp/frams/genetics/fL/fL_oper.cpp
r1273 r1298 181 181 else 182 182 { 183 int rid = rndUint( (unsigned int)creature->rules.size());183 int rid = rndUint(creature->rules.size()); 184 184 list = &creature->rules[rid]->objsucc; 185 185 numparams = creature->rules[rid]->objpred->npar; … … 313 313 if (creature->rules.size() > 0) 314 314 { 315 int ruleid = rndUint( (unsigned int)creature->rules.size());315 int ruleid = rndUint(creature->rules.size()); 316 316 if (!creature->rules[ruleid]->condeval) 317 317 { … … 350 350 if (wordswithnorules.size() > 0) 351 351 { 352 int predid = rndUint( (unsigned int)wordswithnorules.size());352 int predid = rndUint(wordswithnorules.size()); 353 353 fL_Rule *newrule = new fL_Rule(0, 0); 354 354 fL_Word *pred = new fL_Word(); … … 362 362 else if (creature->rules.size() > 0) 363 363 { 364 int ruleid = rndUint( (unsigned int)creature->rules.size());364 int ruleid = rndUint(creature->rules.size()); 365 365 fL_Rule *newrule = new fL_Rule(0, 0); 366 366 fL_Word *pred = new fL_Word(); … … 465 465 else 466 466 { 467 int rndid = rndUint( (unsigned int)list->size());467 int rndid = rndUint(list->size()); 468 468 std::list<fL_Word *>::iterator it = list->begin(); 469 469 std::advance(it, rndid); … … 492 492 int tmp = 0; 493 493 std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp); 494 int rndid = rndUint( (unsigned int)list->size());494 int rndid = rndUint(list->size()); 495 495 std::list<fL_Word *>::iterator it = list->begin(); 496 496 std::advance(it, rndid); … … 541 541 int tmp = 0; 542 542 std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp); 543 int rndid = rndUint( (unsigned int)list->size());543 int rndid = rndUint(list->size()); 544 544 std::list<fL_Word *>::iterator selectedword = list->begin(); 545 545 std::advance(selectedword, rndid); … … 555 555 int numpars = 0; 556 556 std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp); 557 int rndid = rndUint( (unsigned int)list->size());557 int rndid = rndUint(list->size()); 558 558 std::list<fL_Word *>::iterator it = list->begin(); 559 559 std::advance(it, rndid); … … 587 587 if (available.size() > 0) 588 588 { 589 int newnameid = rndUint( (unsigned int)available.size());589 int newnameid = rndUint(available.size()); 590 590 (*selectedword)->name = available[newnameid]->name; 591 591 } … … 762 762 for (int i = 0; i < numselrules; i++) 763 763 { 764 int rulid = rndUint( (unsigned int)from->rules.size());764 int rulid = rndUint(from->rules.size()); 765 765 fL_Rule *rul = from->rules[rulid]; 766 766 fL_Rule *newrule = new fL_Rule(0, 0);
Note: See TracChangeset
for help on using the changeset viewer.