* speed up hop-to-hop calculations
* better and faster trip clustering: trip tries * add --write-colors to extract line colors from OSM data * refactor config parameter names, update default pfaedle.cfg * add --stats for writing a stats.json file * add --no-fast-hops, --no-a-star, --no-trie for debugging * general refactoring
This commit is contained in:
parent
f1822868c5
commit
4c29892658
126 changed files with 14576 additions and 12196 deletions
40
src/pfaedle/router/HopCache.cpp
Normal file
40
src/pfaedle/router/HopCache.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2020, University of Freiburg,
|
||||
// Chair of Algorithms and Data Structures.
|
||||
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
|
||||
|
||||
#include <utility>
|
||||
#include <set>
|
||||
#include "pfaedle/router/HopCache.h"
|
||||
#include "pfaedle/trgraph/Graph.h"
|
||||
#include "util/Misc.h"
|
||||
|
||||
using pfaedle::router::HopCache;
|
||||
using pfaedle::trgraph::Edge;
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void HopCache::setMin(const Edge* a, const Edge* b, uint32_t val) {
|
||||
_cache.set(a, b, val);
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void HopCache::setEx(const Edge* a, const Edge* b, uint32_t val) {
|
||||
int64_t v = val;
|
||||
_cache.set(a, b, -(v + 1));
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void HopCache::setMin(const Edge* a, const std::set<Edge*>& b, uint32_t val) {
|
||||
for (auto eb : b) _cache.set(a, eb, val);
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void HopCache::setMin(const std::set<Edge*>& a, const Edge* b, uint32_t val) {
|
||||
for (auto ea : a) _cache.set(ea, b, val);
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
std::pair<uint32_t, bool> HopCache::get(const Edge* a, const Edge* b) const {
|
||||
int64_t v = _cache.get(a, b);
|
||||
if (v < 0) return {(-v) - 1, 1};
|
||||
return {v, 0};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue