- Timestamp:
- 03/29/24 23:34:00 (7 months ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fH/fH_general.cpp
r1261 r1299 352 352 } 353 353 354 unsigned int stickscount = children->size() + 1;354 size_t stickscount = children->size() + 1; 355 355 356 356 MultiRange ranges; … … 469 469 // next stick is selected by minimum distance between first vector of its handle 470 470 // and second vector of any existing StickHandle in body 471 int remaining = sticks.size() - 2;471 int remaining = int(sticks.size()) - 2; 472 472 while (remaining > 0) 473 473 { … … 880 880 int fH_Builder::removeNeuronsWithInvalidClasses() 881 881 { 882 int count = neurons.size();882 int count = (int)neurons.size(); 883 883 if (count == 0) 884 884 { … … 913 913 914 914 } 915 return count - neurons.size();915 return count - (int)neurons.size(); 916 916 } 917 917 -
cpp/frams/genetics/fH/fH_oper.cpp
r1273 r1299 237 237 238 238 // used for computing chg 239 unsigned int sumgenes = creature->sticks.size() + creature->neurons.size() + creature->connections.size();239 size_t sumgenes = creature->sticks.size() + creature->neurons.size() + creature->connections.size(); 240 240 241 241 // if there is only one element in genotype (stick), then deletion would end … … 401 401 unsigned int Geno_fH::getRandomHandle(fH_Builder *creature, fH_Handle *&handle, ParamEntry *&tab, bool skipalonestick) 402 402 { 403 unsigned int allhandlescount = creature->connections.size() + creature->neurons.size();403 size_t allhandlescount = creature->connections.size() + creature->neurons.size(); 404 404 if (!skipalonestick || creature->sticks.size() > 1) 405 405 { 406 406 allhandlescount += creature->sticks.size(); 407 407 } 408 unsignedint toselect = rndUint(allhandlescount);409 if ( toselect < creature->connections.size())408 int toselect = rndUint(allhandlescount); 409 if ((size_t)toselect < creature->connections.size()) 410 410 { 411 411 handle = creature->connections[toselect]; … … 413 413 return toselect; 414 414 } 415 else if (toselect - creature->connections.size() <creature->neurons.size())416 { 417 toselect -= creature->connections.size();415 else if (toselect - (int)creature->connections.size() < (int)creature->neurons.size()) 416 { 417 toselect -= (int)creature->connections.size(); 418 418 handle = creature->neurons[toselect]; 419 419 tab = creature->neuronparamtab; 420 if (toselect < 0) 421 logMessage("Geno_fH", "getRandomHandle", LOG_CRITICAL, "toselect<0"); 420 422 return toselect; 421 423 } 422 toselect -= creature->connections.size() + creature->neurons.size();424 toselect -= int(creature->connections.size() + creature->neurons.size()); 423 425 handle = creature->sticks[toselect]; 424 426 tab = creature->stickparamtab; 427 if (toselect < 0) 428 logMessage("Geno_fH", "getRandomHandle", LOG_CRITICAL, "toselect<0"); 425 429 return toselect; 426 430 } -
cpp/frams/genetics/fL/fL_matheval.cpp
r896 r1299 648 648 if (type == 0) 649 649 { 650 count = operatorstrings.size();650 count = int(operatorstrings.size()); 651 651 } 652 652 else if (type == 2) 653 653 { 654 count = operatorstrings.size() - arithmeticoperatorscount;654 count = int(operatorstrings.size()) - arithmeticoperatorscount; 655 655 } 656 656 randop += rndUint(count); … … 662 662 if (varcount > 0) 663 663 { 664 int currsize = postfixlist.size();664 size_t currsize = postfixlist.size(); 665 665 int varid = rndUint(varcount); 666 666 postfixlist.push_back(vars[varid]); … … 704 704 std::list<Token *>::iterator it = postfixlist.begin(); 705 705 // insertion can be applied from 1st occurrence 706 int insertlocation = 1 + rndUint( postfixlist.size() - 1);706 int insertlocation = 1 + rndUint((int)postfixlist.size() - 1); 707 707 std::advance(it, insertlocation); 708 708 Operator *rndop;
Note: See TracChangeset
for help on using the changeset viewer.