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

View file

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

View file

@ -31,6 +31,7 @@ inline Stats operator+ (const Stats& c1, const Stats& c2) {
Stats ret = c1;
ret.totNumTrips += c2.totNumTrips;
ret.numTries += c2.numTries;
ret.numTrieLeafs += c2.numTrieLeafs;
ret.solveTime += c2.solveTime;
ret.dijkstraIters += c2.dijkstraIters;
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}
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;
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));
if (AN <= 0.0001) _acc0++;
if (AN <= 0.1) _acc10++;
if (AN <= 0.2) _acc20++;
if (AN <= 0.4) _acc40++;
if (AN <= 0.8) _acc80++;
if (AN <= 0.0001) _an0++;
if (AN <= 0.05) _an5++;
if (AN <= 0.1) _an10++;
if (AN <= 0.3) _an30++;
if (AN <= 0.5) _an50++;
if (AN <= 0.7) _an70++;
if (AN <= 0.9) _an90++;
LOG(VDEBUG) << "This result (" << oldT->getId()
<< "): 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)
// 6) To normalize this, we always the following approach:
// 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
// c) Project the GROUND TRUTH station coordinate to this segment
// d) The result is the cutting point
// b) Extract a segment of 200 meters, with the measurement progress in
// the middle c) Project the GROUND TRUTH station coordinate to this
// segment d) The result is the cutting point
// 7) If a completely wrong track was chosen, the frechet distance will still
// be greater than 20 meters and AN will measure an unmatch.
// 8) TODO: implement this, explain this in diss
@ -258,37 +260,39 @@ void Collector::printCsv(std::ostream* os,
// _____________________________________________________________________________
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 {
if (_results.size()) {
(*os) << "acc-0: "
<< (static_cast<double>(_acc0) /
(*os) << (static_cast<double>(_an0) /
static_cast<double>(_results.size())) *
100
<< " %";
(*os) << " acc-10: "
<< (static_cast<double>(_acc10) /
<< ",";
(*os) << (static_cast<double>(_an5) /
static_cast<double>(_results.size())) *
100
<< " %";
(*os) << " acc-20: "
<< (static_cast<double>(_acc20) /
<< ",";
(*os) << (static_cast<double>(_an10) /
static_cast<double>(_results.size())) *
100
<< " %";
(*os) << " acc-40: "
<< (static_cast<double>(_acc40) /
<< ",";
(*os) << (static_cast<double>(_an30) /
static_cast<double>(_results.size())) *
100
<< " %";
(*os) << " acc-80: "
<< (static_cast<double>(_acc80) /
<< ",";
(*os) << (static_cast<double>(_an50) /
static_cast<double>(_results.size())) *
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";
(*os) << "\n";
(*os) << " acc-0: "
<< (static_cast<double>(_acc0) /
(*os) << " an-0: "
<< (static_cast<double>(_an0) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-10: "
<< (static_cast<double>(_acc10) /
(*os) << " an-5: "
<< (static_cast<double>(_an5) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-20: "
<< (static_cast<double>(_acc20) /
(*os) << " an-10: "
<< (static_cast<double>(_an10) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-40: "
<< (static_cast<double>(_acc40) /
(*os) << " acc-30: "
<< (static_cast<double>(_an30) /
static_cast<double>(_results.size())) *
100
<< " %"
<< "\n";
(*os) << " acc-80: "
<< (static_cast<double>(_acc80) /
(*os) << " acc-50: "
<< (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())) *
100
<< " %"

View file

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