yakra / DataProcessing

Data Processing Scripts and Programs for Travel Mapping Project
0 stars 0 forks source link

self-concurrency effects on HighwaySystem::mileage_by_region #288

Open yakra opened 1 month ago

yakra commented 1 month ago

Does any single route have more mileage than its HighwaySystem::mileage_by_region?

yakra commented 1 month ago

RailwayData @ eeea42fb2e1178e0d8f7f6e5ef631385ba46a8ab

#include "tasks/threaded/CompStats.cpp"

cout << "system | route | mileage | system<br>region<br>mileage | ratio | system<br>mileage | ratio | region<br>active<br>preview | ratio\n";
cout << "| - | - | - | - | - | - | - | - | - |\n";
for (auto& h : HighwaySystem::syslist)
  for (auto& r : h.routes)
  { double hmbr = h.mileage_by_region.at(r.region);
    double r_ratio = 100 * r.mileage / hmbr;
    if (r_ratio > 100.0000000000001)
    {   double s_mi = h.total_mileage();
        double r_mi = r.region->active_preview_mileage;
        printf("%s | %s | %.2f | %.2f | %.2f%% | %.2f | %.2f%% | %.2f | %.2f%%\n",
            &h.systemname[0], &r.root[0],
            r.mileage, hmbr, r_ratio,
            s_mi, 100*r.mileage/s_mi,
            r_mi, 100*r.mileage/r_mi);
    }
  }
return 0;
system route mileage system
region
mileage
ratio system
mileage
ratio region
active
preview
ratio
chncrh chntj.hsrjinghu 65.44 64.03 102.20% 3688.60 1.77% 64.03 102.20%
espave espvc.gijvin 160.24 159.89 100.22% 1567.46 10.22% 531.83 30.13%
gbnht eng.ecmlhul 216.50 216.04 100.21% 216.04 100.21% 7502.19 2.89%
gbngw wls.swalml 102.22 101.21 101.01% 1125.58 9.08% 781.73 13.08%
usaamtk fl.ss 533.63 506.40 105.38% 21421.67 2.49% 797.68 66.90%
usarrm ar.blueln 2.90 2.35 123.63% 2.35 123.63% 312.89 0.93%
usast az.sunlink 4.06 3.86 105.22% 3.86 105.22% 821.30 0.49%
usaelpsc tx.elpasostr 5.00 4.89 102.24% 4.89 102.24% 1755.63 0.28%
usagal tx.galisltro 4.24 3.20 132.46% 3.20 132.46% 1755.63 0.24%
usamck tx.mlntro 4.55 3.76 120.81% 3.76 120.81% 1755.63 0.26%
yakra commented 1 month ago

zzz.list: PA I-376 69A 69B

3,4c3,4
< Overall in active systems: 0.49 of 1240604.32 mi (0.00%)
< Overall in active+preview systems: 0.49 of 1909958.47 mi (0.00%)
---
> Overall in active systems: 0.66 of 1240608.15 mi (0.00%)
> Overall in active+preview systems: 0.66 of 1909962.89 mi (0.00%)
6c6
< PA: 0.49 of 17661.58 mi (0.00%), 0.49 of 17661.58 mi (0.00%)
---
> PA: 0.66 of 17661.74 mi (0.00%), 0.66 of 17661.74 mi (0.00%)
127c127
< System usausb (active) overall: 0.49 of 7544.54 mi (0.01%)
---
> System usausb (active) overall: 0.99 of 7545.04 mi (0.01%)
164c164
<   PA: 0.49 of 289.53 mi (0.17%)
---
>   PA: 0.99 of 290.02 mi (0.34%)

The bug: Active, a/p, and overall stats get double-credited only 1/3 of the time, from the 2 usausb routes but not the 1 interstate or the 3 usaus routes. End result is 1.33x credit, 0.66 mi instead of 0.99 mi as intended.

Changes to compute_stats.cpp: