some updates to shapevl

This commit is contained in:
Patrick Brosi 2022-01-07 17:35:30 +01:00
parent 3a08b63d8e
commit 6b445b84d1
5 changed files with 68 additions and 46 deletions

View file

@ -346,10 +346,15 @@ int main(int argc, char** argv) {
if (cfg.writeStats) { if (cfg.writeStats) {
util::json::Dict graphSizes; util::json::Dict graphSizes;
double numNodesTot = 0;
double numEdgesTot = 0;
for (const auto& gd : graphDimensions) { for (const auto& gd : graphDimensions) {
util::json::Dict a; util::json::Dict a;
a["num_nodes"] = gd.second.first; a["num_nodes"] = gd.second.first;
a["num_edges"] = gd.second.second; a["num_edges"] = gd.second.second;
numNodesTot += gd.second.first;
numEdgesTot += gd.second.second;
graphSizes[gd.first] = a; graphSizes[gd.first] = a;
} }
@ -358,7 +363,10 @@ int main(int argc, char** argv) {
util::json::Dict{ util::json::Dict{
{"gtfs_num_stations", gtfs[0].getStops().size()}, {"gtfs_num_stations", gtfs[0].getStops().size()},
{"gtfs_num_trips", gtfs[0].getTrips().size()}, {"gtfs_num_trips", gtfs[0].getTrips().size()},
{"gtfs_has_shapes", gtfs[0].getShapes().size() > 1},
{"graph_dimension", graphSizes}, {"graph_dimension", graphSizes},
{"num_nodes_tot", numNodesTot},
{"num_edges_tot", numEdgesTot},
{"num_tries", stats.numTries}, {"num_tries", stats.numTries},
{"num_trie_leafs", stats.numTrieLeafs}, {"num_trie_leafs", stats.numTrieLeafs},
{"dijkstra_iters", stats.dijkstraIters}, {"dijkstra_iters", stats.dijkstraIters},

View file

@ -206,12 +206,7 @@ void ConfigReader::read(Config* cfg, int argc, char** argv) {
cfg->noHopCache = true; cfg->noHopCache = true;
break; break;
case 'v': case 'v':
std::cout << "pfaedle " << VERSION_FULL << " (built " << __DATE__ << " " std::cout << "pfaedle " << VERSION_FULL << std::endl;
<< __TIME__ << " with geometry precision <"
<< PFDL_PREC_STR << ">)\n"
<< "(C) " << YEAR << " " << COPY << "\n"
<< "Authors: " << AUTHORS << "\nGNU General Public "
"License v3.0\n";
exit(0); exit(0);
case 'p': case 'p':
printOpts = true; printOpts = true;

View file

@ -31,6 +31,7 @@ inline Stats operator+ (const Stats& c1, const Stats& c2) {
Stats ret = c1; Stats ret = c1;
ret.totNumTrips += c2.totNumTrips; ret.totNumTrips += c2.totNumTrips;
ret.numTries += c2.numTries; ret.numTries += c2.numTries;
ret.numTrieLeafs += c2.numTrieLeafs;
ret.solveTime += c2.solveTime; ret.solveTime += c2.solveTime;
ret.dijkstraIters += c2.dijkstraIters; ret.dijkstraIters += c2.dijkstraIters;
return ret; return ret;

View file

@ -59,7 +59,7 @@ double Collector::add(const Trip* oldT, const Shape* oldS, const Trip* newT,
// A "segment" is a path from station s_i to station s_{i+1} // A "segment" is a path from station s_i to station s_{i+1}
size_t unmatchedSegments; // number of unmatched segments size_t unmatchedSegments; // number of unmatched segments
double unmatchedSegmentsLength; // total _acc. length of unmatched segments double unmatchedSegmentsLength; // total _an. length of unmatched segments
std::vector<double> oldDists; std::vector<double> oldDists;
LINE oldL = getWebMercLine(oldS, &oldDists); LINE oldL = getWebMercLine(oldS, &oldDists);
@ -127,11 +127,13 @@ double Collector::add(const Trip* oldT, const Shape* oldS, const Trip* newT,
_results.insert(Result(oldT, avgFd)); _results.insert(Result(oldT, avgFd));
if (AN <= 0.0001) _acc0++; if (AN <= 0.0001) _an0++;
if (AN <= 0.1) _acc10++; if (AN <= 0.05) _an5++;
if (AN <= 0.2) _acc20++; if (AN <= 0.1) _an10++;
if (AN <= 0.4) _acc40++; if (AN <= 0.3) _an30++;
if (AN <= 0.8) _acc80++; if (AN <= 0.5) _an50++;
if (AN <= 0.7) _an70++;
if (AN <= 0.9) _an90++;
LOG(VDEBUG) << "This result (" << oldT->getId() LOG(VDEBUG) << "This result (" << oldT->getId()
<< "): A_N/N = " << unmatchedSegments << "/" << oldSegs.size() << "): A_N/N = " << unmatchedSegments << "/" << oldSegs.size()
@ -169,9 +171,9 @@ std::vector<LINE> Collector::segmentize(const Trip* t, const LINE& shape,
// a different position philosophy than the test data) // a different position philosophy than the test data)
// 6) To normalize this, we always the following approach: // 6) To normalize this, we always the following approach:
// a) Get the exact progression of the measurment on the shape // a) Get the exact progression of the measurment on the shape
// b) Extract a segment of 200 meters, with the measurement progress in the middle // b) Extract a segment of 200 meters, with the measurement progress in
// c) Project the GROUND TRUTH station coordinate to this segment // the middle c) Project the GROUND TRUTH station coordinate to this
// d) The result is the cutting point // segment d) The result is the cutting point
// 7) If a completely wrong track was chosen, the frechet distance will still // 7) If a completely wrong track was chosen, the frechet distance will still
// be greater than 20 meters and AN will measure an unmatch. // be greater than 20 meters and AN will measure an unmatch.
// 8) TODO: implement this, explain this in diss // 8) TODO: implement this, explain this in diss
@ -258,37 +260,39 @@ void Collector::printCsv(std::ostream* os,
// _____________________________________________________________________________ // _____________________________________________________________________________
double Collector::getAcc() const { double Collector::getAcc() const {
return static_cast<double>(_acc0) / static_cast<double>(_results.size()); return static_cast<double>(_an0) / static_cast<double>(_results.size());
} }
// _____________________________________________________________________________ // _____________________________________________________________________________
void Collector::printShortStats(std::ostream* os) const { void Collector::printShortStats(std::ostream* os) const {
if (_results.size()) { if (_results.size()) {
(*os) << "acc-0: " (*os) << (static_cast<double>(_an0) /
<< (static_cast<double>(_acc0) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %"; << ",";
(*os) << " acc-10: " (*os) << (static_cast<double>(_an5) /
<< (static_cast<double>(_acc10) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %"; << ",";
(*os) << " acc-20: " (*os) << (static_cast<double>(_an10) /
<< (static_cast<double>(_acc20) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %"; << ",";
(*os) << " acc-40: " (*os) << (static_cast<double>(_an30) /
<< (static_cast<double>(_acc40) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %"; << ",";
(*os) << " acc-80: " (*os) << (static_cast<double>(_an50) /
<< (static_cast<double>(_acc80) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %"; << ",";
(*os) << (static_cast<double>(_an70) /
static_cast<double>(_results.size())) *
100
<< ",";
(*os) << (static_cast<double>(_an90) /
static_cast<double>(_results.size())) *
100;
} }
} }
@ -313,32 +317,44 @@ void Collector::printStats(std::ostream* os) const {
<< " averaged avg frechet distance: " << getAvgDist() << "\n"; << " averaged avg frechet distance: " << getAvgDist() << "\n";
(*os) << "\n"; (*os) << "\n";
(*os) << " acc-0: " (*os) << " an-0: "
<< (static_cast<double>(_acc0) / << (static_cast<double>(_an0) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %" << " %"
<< "\n"; << "\n";
(*os) << " acc-10: " (*os) << " an-5: "
<< (static_cast<double>(_acc10) / << (static_cast<double>(_an5) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %" << " %"
<< "\n"; << "\n";
(*os) << " acc-20: " (*os) << " an-10: "
<< (static_cast<double>(_acc20) / << (static_cast<double>(_an10) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %" << " %"
<< "\n"; << "\n";
(*os) << " acc-40: " (*os) << " acc-30: "
<< (static_cast<double>(_acc40) / << (static_cast<double>(_an30) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %" << " %"
<< "\n"; << "\n";
(*os) << " acc-80: " (*os) << " acc-50: "
<< (static_cast<double>(_acc80) / << (static_cast<double>(_an50) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-70: "
<< (static_cast<double>(_an70) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-90: "
<< (static_cast<double>(_an90) /
static_cast<double>(_results.size())) * static_cast<double>(_results.size())) *
100 100
<< " %" << " %"

View file

@ -77,11 +77,13 @@ class Collector {
size_t _unmatchedSegSum; size_t _unmatchedSegSum;
double _unmatchedSegLengthSum; double _unmatchedSegLengthSum;
size_t _acc0; size_t _an0;
size_t _acc10; size_t _an5;
size_t _acc20; size_t _an10;
size_t _acc40; size_t _an30;
size_t _acc80; size_t _an50;
size_t _an70;
size_t _an90;
std::ostream* _reportOut; std::ostream* _reportOut;