clean up and refactor half-baked development commits and squash them into a new version.

Changes:

* support for multiple GTFS feeds as input in filtering, read default global and local configuration files
* be a bit more memory conservative
* make caching optional
* dont delete orphan edge if it would transform a degree 3 node with a possible full turn into a degree 2 node eligible for contraction
* dedicated filters for funicular and gondola
* make max snap level option more intuitive
* allow filter rules for level 0
* additional fallback for station snapping
* dont try to route for MOT unequal to trip in -T mode, force-snap to orphaned OSM station if not snap was possible
* write bounds to filtered osm
* remove unused surrounding heuristic
* use bus lanes info
* be a bit more tolerant for bus oneway streets
* create missing directories
* error if no cfg is present, clean up evaluation Makefile
This commit is contained in:
Patrick Brosi 2019-01-10 16:52:59 +01:00
parent 2cc2d2dc23
commit 63f0b61ea1
60 changed files with 4532 additions and 1576 deletions

View file

@ -8,6 +8,7 @@
#include "util/String.h"
#include "util/geo/Geo.h"
#include "util/json/Writer.h"
#include "util/graph/Algorithm.h"
#include "util/graph/DirGraph.h"
#include "util/graph/UndirGraph.h"
#include "util/graph/Dijkstra.h"
@ -403,6 +404,46 @@ CASE("editdist") {
EXPECT(util::editDist("hello", "hello") == (size_t)0);
}},
// ___________________________________________________________________________
{
CASE("prefixeditdist") {
EXPECT(util::prefixEditDist("hello", "hello", 0) == (size_t)0);
EXPECT(util::prefixEditDist("hello", "hello", 100) == (size_t)0);
EXPECT(util::prefixEditDist("hello", "hello") == (size_t)0);
EXPECT(util::prefixEditDist("hel", "hello") == (size_t)0);
EXPECT(util::prefixEditDist("hel", "hello", 0) == (size_t)0);
EXPECT(util::prefixEditDist("hel", "hello", 1) == (size_t)0);
EXPECT(util::prefixEditDist("hel", "hello", 2) == (size_t)0);
EXPECT(util::prefixEditDist("hal", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("hal", "hello", 1) == (size_t)1);
EXPECT(util::prefixEditDist("hal", "hello", 0) > (size_t)0);
EXPECT(util::prefixEditDist("fel", "hello", 0) > (size_t)0);
EXPECT(util::prefixEditDist("fel", "hello", 1) == (size_t)1);
EXPECT(util::prefixEditDist("fel", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("fal", "hello", 2) == (size_t)2);
EXPECT(util::prefixEditDist("fal", "hello", 1) > (size_t)1);
EXPECT(util::prefixEditDist("fal", "hello", 0) > (size_t)0);
EXPECT(util::prefixEditDist("far", "hello", 0) > (size_t)0);
EXPECT(util::prefixEditDist("far", "hello", 1) > (size_t)1);
EXPECT(util::prefixEditDist("far", "hello", 2) > (size_t)2);
EXPECT(util::prefixEditDist("far", "hello", 3) == (size_t)3);
EXPECT(util::prefixEditDist("far", "hello", 4) == (size_t)3);
EXPECT(util::prefixEditDist("far", "hello") == (size_t)3);
EXPECT(util::prefixEditDist("hefar", "hello") == (size_t)3);
EXPECT(util::prefixEditDist("hefaree", "hello") == (size_t)5);
EXPECT(util::prefixEditDist("helloo", "hello") == (size_t)1);
EXPECT(util::prefixEditDist("helloo", "hello", 0) > (size_t)0);
EXPECT(util::prefixEditDist("helloo", "hello", 1) == (size_t)1);
EXPECT(util::prefixEditDist("helloo", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("", "hello", 2) == (size_t)0);
EXPECT(util::prefixEditDist("e", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("el", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("ello", "hello", 2) == (size_t)1);
EXPECT(util::prefixEditDist("hell", "hello", 2) == (size_t)0);
EXPECT(util::prefixEditDist("hell", "", 2) > (size_t)2);
EXPECT(util::prefixEditDist("hell", "") == (size_t)4);
}},
// ___________________________________________________________________________
{
CASE("toString") {
@ -447,6 +488,51 @@ CASE("replace") {
EXPECT(b == "loree aaaau aaaau loree");
}},
// ___________________________________________________________________________
{
CASE("Connected components undirected") {
UndirGraph<std::string, int> g;
auto a = g.addNd("A");
auto b = g.addNd("B");
auto c = g.addNd("C");
auto d = g.addNd("D");
auto e = g.addNd("E");
g.addEdg(a, c, 1);
g.addEdg(a, b, 5);
g.addEdg(d, c, 1);
g.addEdg(d, b, 3);
g.addEdg(e, d, 1);
g.addEdg(e, b, 1);
auto comps = util::graph::Algorithm::connectedComponents(g);
EXPECT(comps.size() == static_cast<size_t>(1));
EXPECT(comps[0].count(a));
EXPECT(comps[0].count(b));
EXPECT(comps[0].count(c));
EXPECT(comps[0].count(d));
EXPECT(comps[0].count(e));
auto f = g.addNd("F");
comps = util::graph::Algorithm::connectedComponents(g);
EXPECT(comps.size() == static_cast<size_t>(2));
auto gn = g.addNd("G");
comps = util::graph::Algorithm::connectedComponents(g);
EXPECT(comps.size() == static_cast<size_t>(3));
g.addEdg(f, gn, 1);
comps = util::graph::Algorithm::connectedComponents(g);
EXPECT(comps.size() == static_cast<size_t>(2));
g.addEdg(f, a, 1);
comps = util::graph::Algorithm::connectedComponents(g);
EXPECT(comps.size() == static_cast<size_t>(1));
}},
// ___________________________________________________________________________
{
CASE("Edge-based Dijkstra directed, 1 to all") {