Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions siteupdate/cplusplus/classes/TravelerList/TravelerList.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,6 @@ class TravelerList
std::unordered_map<Region*, double> active_preview_mileage_by_region; // total mileage per region, active+preview only
std::unordered_map<Region*, double> active_only_mileage_by_region; // total mileage per region, active only
std::unordered_map<HighwaySystem*, std::unordered_map<Region*, double>> system_region_mileages; // mileage per region per system
std::unordered_map<HighwaySystem*, std::unordered_map<ConnectedRoute*, double>> con_routes_traveled; // mileage per ConRte per system
// TODO is this necessary?
// ConRtes by definition exist in one system only
std::unordered_map<Route*, double> routes_traveled; // mileage per traveled route
std::unordered_map<HighwaySystem*, unsigned int> con_routes_clinched; // clinch count per system
//std::unordered_map<HighwaySystem*, unsigned int> routes_clinched; // commented out in original siteupdate.py
unsigned int *traveler_num;
unsigned int active_systems_traveled;
unsigned int active_systems_clinched;
Expand Down
11 changes: 4 additions & 7 deletions siteupdate/cplusplus/classes/TravelerList/userlog.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,7 +77,7 @@ void TravelerList::userlog

// stats by highway for the system, by connected route and
// by each segment crossing region boundaries if applicable
std::unordered_map<ConnectedRoute*, double> system_con_umap;
unsigned int num_con_rtes_traveled = 0;
unsigned int num_con_rtes_clinched = 0;
log << "System " << h->systemname << " by route (traveled routes only):\n";
for (ConnectedRoute &cr : h->con_route_list)
Expand All@@ -92,13 +92,12 @@ void TravelerList::userlog
sprintf(fstr, "%.15g", miles);
if (!strchr(fstr, '.')) strcat(fstr, ".0");
clin_db_val->add_cr("('" + r->root + "','" + traveler_name + "','" + std::string(fstr) + "','" + clinched + "')");
routes_traveled[r] = miles;
con_clinched_miles += miles;
to_write += " " + r->readable_name() + ": " + format_clinched_mi(miles,r->mileage) + "\n";
}
}
if (con_clinched_miles)
{ system_con_umap[&cr] = con_clinched_miles;
{ num_con_rtes_traveled += 1;
char clinched = '0';
if (con_clinched_miles == cr.mileage)
{ num_con_rtes_clinched++;
Expand All@@ -114,12 +113,10 @@ void TravelerList::userlog
else log << to_write << '\n';
}
}
con_routes_clinched[h] = num_con_rtes_clinched;
sprintf(fstr, " connected routes traveled: %i of %i (%.1f%%), clinched: %i of %i (%.1f%%).",
(int)system_con_umap.size(), (int)h->con_route_list.size(), 100*(double)system_con_umap.size()/h->con_route_list.size(),
num_con_rtes_clinched, (int)h->con_route_list.size(), 100*(double)num_con_rtes_clinched/h->con_route_list.size());
num_con_rtes_traveled, (int)h->con_route_list.size(), 100*(double)num_con_rtes_traveled/h->con_route_list.size(),
num_con_rtes_clinched, (int)h->con_route_list.size(), 100*(double)num_con_rtes_clinched/h->con_route_list.size());
log << "System " << h->systemname << fstr << '\n';
con_routes_traveled[h] = system_con_umap;
}
}

Expand Down
18 changes: 4 additions & 14 deletions siteupdate/python-teresco/siteupdate.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -3342,13 +3342,6 @@ def run(self):
t.preview_systems_clinched = 0
active_systems = 0
preview_systems = 0
# "traveled" dictionaries indexed by system name, then conn or regular
# route in another dictionary with keys route, values mileage
# "clinched" dictionaries indexed by system name, values clinch count
t.con_routes_traveled = dict()
t.con_routes_clinched = dict()
t.routes_traveled = dict()
#t.routes_clinched = dict()

# present stats by system here, also generate entries for
# DB table clinchedSystemMileageByRegion as we compute and
Expand DownExpand Up@@ -3393,8 +3386,7 @@ def run(self):

# stats by highway for the system, by connected route and
# by each segment crossing region boundaries if applicable
system_con_dict = dict()
t.con_routes_traveled[h.systemname] = system_con_dict
con_routes_traveled = 0
con_routes_clinched = 0
t.log_entries.append("System " + h.systemname + " by route (traveled routes only):")
for cr in h.con_route_list:
Expand All@@ -3410,12 +3402,11 @@ def run(self):
clinched = '0'
cr_values.append("('" + r.root + "','" + t.traveler_name + "','" +
str(miles) + "','" + clinched + "')")
t.routes_traveled[r] = miles
con_clinched_miles += miles
to_write += " " + r.readable_name() + ": " + \
format_clinched_mi(miles,r.mileage) + "\n"
if con_clinched_miles > 0:
system_con_dict[cr] = con_clinched_miles
con_routes_traveled += 1
clinched = '0'
if con_clinched_miles == cr.mileage:
con_routes_clinched += 1
Expand All@@ -3429,11 +3420,10 @@ def run(self):
t.log_entries.append(" (" + cr.roots[0].readable_name() + " only)")
else:
t.log_entries.append(to_write)
t.con_routes_clinched[h.systemname] = con_routes_clinched
t.log_entries.append("System " + h.systemname + " connected routes traveled: " + \
str(len(system_con_dict)) + " of " + \
str(con_routes_traveled) + " of " + \
str(len(h.con_route_list)) + \
" ({0:.1f}%)".format(100*len(system_con_dict)/len(h.con_route_list)) + \
" ({0:.1f}%)".format(100*con_routes_traveled/len(h.con_route_list)) + \
", clinched: " + str(con_routes_clinched) + " of " + \
str(len(h.con_route_list)) + \
" ({0:.1f}%)".format(100*con_routes_clinched/len(h.con_route_list)) + \
Expand Down