MCPcopy Create free account
hub / github.com/devosoft/avida / PrintStringMatchData

Method PrintStringMatchData

avida-core/source/main/cStats.cc:3421–3533  ·  view source on GitHub ↗

Print information about the string matching... */

Source from the content-addressed store, hash-verified

3419
3420/* Print information about the string matching... */
3421void cStats::PrintStringMatchData(const cString& filename)
3422{
3423 Avida::Output::FilePtr df = Avida::Output::File::StaticWithPath(m_world->GetNewWorld(), (const char*)filename);
3424 df->WriteComment("Avida organism string donation information");
3425 df->WriteTimeStamp();
3426 df->Write(m_update, "Update [update]");
3427 cOrganism* org;
3428
3429
3430 /*
3431 // Interate through map of information.
3432 map<cString,cDoubleSum>::iterator iter2;
3433 for(iter2 = m_string_bits_matched.begin(); iter2 != m_string_bits_matched.end(); iter2++ ) {
3434 df->Write(iter2->second.Average(), iter2->first);
3435 }
3436
3437
3438 // Create a map of the current tags in the population .
3439 for(int i=0; i<m_world->GetPopulation().GetSize(); ++i) {
3440 cPopulationCell& cell = m_world->GetPopulation().GetCell(i);
3441 org = cell.GetOrganism();
3442
3443 if(cell.IsOccupied()) {
3444 // Get tag and increment number of orgs.
3445 m_tags[org->GetTagLabel()]++;
3446 }
3447 }
3448
3449 // print the tags
3450 map<int, int>::iterator iter;
3451 stringstream ss;
3452 for(iter = m_tags.begin(); iter != m_tags.end(); iter++ ) {
3453 ss << iter->first;
3454 string name = ss.str();
3455 df->Write(iter->second, name.c_str());
3456 iter->second = 0;
3457 }*/
3458
3459
3460 // Print data about strings:
3461 std::map <int, cDoubleSum> m_strings_stored;
3462 std::map <int, cDoubleSum> m_strings_produced;
3463 cDoubleSum total;
3464 int min = -1;
3465 int onhand = 0;
3466 int instant_perfect_match = 0;
3467 int instant_perfect_match_org = 0;
3468 int nothing =0;
3469 int specialists = 0;
3470 int generalists = 0;
3471 int type_prod = 0;
3472
3473 // Get the number of strings
3474 int num = m_world->GetEnvironment().GetNumberOfMatchStrings();
3475 for(int i=0; i<m_world->GetPopulation().GetSize(); ++i) {
3476 cPopulationCell& cell = m_world->GetPopulation().GetCell(i);
3477 org = cell.GetOrganism();
3478 min = -1;

Callers

nothing calls this directly

Calls 15

GetNewWorldMethod · 0.80
WriteCommentMethod · 0.80
WriteTimeStampMethod · 0.80
WriteMethod · 0.80
IsOccupiedMethod · 0.80
EndlMethod · 0.80
GetSizeMethod · 0.45
GetCellMethod · 0.45
GetOrganismMethod · 0.45

Tested by

no test coverage detected