some minor changes

This commit is contained in:
Patrick Brosi 2022-01-17 13:29:35 +01:00
parent ea79e3ac52
commit 39fb167cbf
7 changed files with 49 additions and 19 deletions

View file

@ -75,6 +75,7 @@ double Collector::add(const Trip* oldT, const Shape* oldS, const Trip* newT,
for (const auto& p : oldLenDists) {
_distDiffs.push_back(fabs(p.first - p.second));
_hopDists.push_back(p.first);
}
// new lines build from cleaned-up shapes
@ -352,6 +353,15 @@ std::map<string, double> Collector::getStats() {
stats["median-dist-diff"] = -1;
}
if (_hopDists.size()) {
double s = 0;
for (auto d : _hopDists) s += d;
stats["avg-hop-dist"] = s / (_hopDists.size() * 1.0);
} else {
stats["avg-hop-dist"] = -1;
}
stats["num-trips"] = _trips;
stats["num-trips-matched"] = _results.size();
stats["num-trips-wo-shapes"] = _noOrigShp;
@ -386,10 +396,13 @@ std::pair<size_t, double> Collector::getDa(const std::vector<LINE>& a,
std::pair<size_t, double> ret{0, 0};
// convert (roughly) to degrees
double SEGL = 15.0 / util::geo::M_PER_DEG;
double SEGL = 15 / util::geo::M_PER_DEG;
double MAX = 50;
for (size_t i = 0; i < a.size(); i++) {
double fdMeter = 0;
auto old = _dACache.find(a[i]);
if (old != _dACache.end()) {
auto match = old->second.find(b[i]);
@ -404,7 +417,7 @@ std::pair<size_t, double> Collector::getDa(const std::vector<LINE>& a,
_dACache[a[i]][b[i]] = fdMeter;
}
if (fdMeter >= 50) {
if (fdMeter >= MAX) {
ret.first++;
ret.second += util::geo::latLngLen(a[i]);
}

View file

@ -98,6 +98,7 @@ class Collector {
size_t _noOrigShp;
std::vector<double> _distDiffs;
std::vector<double> _hopDists;
double _fdSum;
size_t _unmatchedSegSum;

View file

@ -8,6 +8,8 @@
#include <iostream>
#include <string>
#include <thread>
#include <sys/resource.h>
#include <stdio.h>
#include <vector>
#include "ad/cppgtfs/Parser.h"
#include "shapevl/Collector.h"
@ -42,8 +44,7 @@ void eval(const std::vector<std::string>* paths,
int myFeed = count-- - 1;
if (myFeed < 0) return;
std::string path = (*paths)[myFeed];
LOG(DEBUG) << "Reading eval feed " << path << " "
<< " ...";
LOG(DEBUG) << "Reading eval feed " << path << " ...";
ad::cppgtfs::gtfs::Feed feed;
ad::cppgtfs::Parser p;
@ -80,6 +81,13 @@ int main(int argc, char** argv) {
// initialize randomness
srand(time(NULL) + rand()); // NOLINT
// increase max stack size for frechet distance calc
struct rlimit rl;
getrlimit(RLIMIT_STACK, &rl);
std::cout << rl.rlim_max << std::endl;
std::string groundTruthFeedPath, motStr;
motStr = "all";
ad::cppgtfs::gtfs::Feed groundTruthFeed;