// Copyright 2018, University of Freiburg, // Chair of Algorithms and Data Structures. // Authors: Patrick Brosi #ifndef PFAEDLE_EVAL_COLLECTOR_H_ #define PFAEDLE_EVAL_COLLECTOR_H_ #include #include #include #include #include #include #include #include "ad/cppgtfs/gtfs/Feed.h" #include "pfaedle/Def.h" #include "shapevl/Result.h" #include "util/geo/Geo.h" using ad::cppgtfs::gtfs::Shape; using ad::cppgtfs::gtfs::Trip; namespace pfaedle { namespace eval { /* * Collects routing results for evaluation */ class Collector { public: Collector(std::ostream* reportOut) : _trips(0), _noOrigShp(0), _fdSum(0), _unmatchedSegSum(0), _unmatchedSegLengthSum(0), _acc0(0), _acc10(0), _acc20(0), _acc40(0), _acc80(0), _reportOut(reportOut) {} // Add a shape found by our tool newS for a trip t with newly calculated // station dist values with the old shape oldS double add(const Trip* oldT, const Shape* oldS, const Trip* newT, const Shape* newS); // Return the set of all Result objects const std::set& getResults() const; // Print general stats to os void printStats(std::ostream* os) const; // Print general stats to os void printShortStats(std::ostream* os) const; // Print a CSV for the results to os void printCsv(std::ostream* os, const std::set& result) const; // Return the averaged average frechet distance double getAvgDist() const; static LINE getWebMercLine(const Shape* s, std::vector* dists); double getAcc() const; private: std::set _results; std::map > _dCache; std::map > > _dACache; size_t _trips; size_t _noOrigShp; double _fdSum; size_t _unmatchedSegSum; double _unmatchedSegLengthSum; size_t _an0; size_t _an5; size_t _an10; size_t _an30; size_t _an50; size_t _an70; size_t _an90; std::ostream* _reportOut; static std::pair getDa(const std::vector& a, const std::vector& b); static std::vector segmentize(const Trip* t, const LINE& shape, const std::vector& dists); static std::vector getBins(double mind, double maxd, size_t steps); }; } // namespace eval } // namespace pfaedle #endif // PFAEDLE_EVAL_COLLECTOR_H_