add gaussian noise parameter
This commit is contained in:
parent
0e5213f049
commit
f10397db41
6 changed files with 30 additions and 20 deletions
|
@ -386,9 +386,6 @@ routing_station_unmatched_penalty: 0.3
|
||||||
# If the platform does not match, add this penalty
|
# If the platform does not match, add this penalty
|
||||||
routing_platform_unmatched_penalty: 0.1
|
routing_platform_unmatched_penalty: 0.1
|
||||||
|
|
||||||
# If the station name does not match, add this penalty
|
|
||||||
routing_station_unmatched_penalty: 0.3
|
|
||||||
|
|
||||||
# Max angle that should be counted as a full turn
|
# Max angle that should be counted as a full turn
|
||||||
routing_full_turn_angle: 100
|
routing_full_turn_angle: 100
|
||||||
|
|
||||||
|
@ -803,9 +800,6 @@ routing_full_turn_penalty: 120 # 2 minutes
|
||||||
# Penalty added to non-station placements
|
# Penalty added to non-station placements
|
||||||
routing_non_station_penalty: 0.5
|
routing_non_station_penalty: 0.5
|
||||||
|
|
||||||
# If the station name does not match, add this penalty
|
|
||||||
routing_station_unmatched_penalty: 0.3
|
|
||||||
|
|
||||||
# Max angle that should be counted as a full turn
|
# Max angle that should be counted as a full turn
|
||||||
routing_full_turn_angle: 20
|
routing_full_turn_angle: 20
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ void ConfigReader::read(Config* cfg, int argc, char** argv) {
|
||||||
{"write-colors", no_argument, 0, 13},
|
{"write-colors", no_argument, 0, 13},
|
||||||
{"stats", no_argument, 0, 14},
|
{"stats", no_argument, 0, 14},
|
||||||
{"no-hop-cache", no_argument, 0, 15},
|
{"no-hop-cache", no_argument, 0, 15},
|
||||||
|
{"gaussian-noise", required_argument, 0, 16},
|
||||||
{0, 0, 0, 0}};
|
{0, 0, 0, 0}};
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
@ -205,6 +206,9 @@ void ConfigReader::read(Config* cfg, int argc, char** argv) {
|
||||||
case 15:
|
case 15:
|
||||||
cfg->noHopCache = true;
|
cfg->noHopCache = true;
|
||||||
break;
|
break;
|
||||||
|
case 16:
|
||||||
|
cfg->gaussianNoise = atof(optarg);
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
std::cout << "pfaedle " << VERSION_FULL << std::endl;
|
std::cout << "pfaedle " << VERSION_FULL << std::endl;
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -35,7 +35,8 @@ struct Config {
|
||||||
noTrie(false),
|
noTrie(false),
|
||||||
noHopCache(false),
|
noHopCache(false),
|
||||||
writeStats(false),
|
writeStats(false),
|
||||||
gridSize(2000 / util::geo::M_PER_DEG) {}
|
gridSize(2000 / util::geo::M_PER_DEG),
|
||||||
|
gaussianNoise(0) {}
|
||||||
std::string dbgOutputPath;
|
std::string dbgOutputPath;
|
||||||
std::string solveMethod;
|
std::string solveMethod;
|
||||||
std::string shapeTripId;
|
std::string shapeTripId;
|
||||||
|
@ -60,6 +61,7 @@ struct Config {
|
||||||
bool noHopCache;
|
bool noHopCache;
|
||||||
bool writeStats;
|
bool writeStats;
|
||||||
double gridSize;
|
double gridSize;
|
||||||
|
double gaussianNoise;
|
||||||
|
|
||||||
std::string toString() {
|
std::string toString() {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
|
@ -167,19 +167,25 @@ EdgeCandGroup ShapeBuilder::getEdgCands(const Stop* s) const {
|
||||||
auto pos = POINT(s->getLng(), s->getLat());
|
auto pos = POINT(s->getLng(), s->getLat());
|
||||||
ret.push_back({0, 0, 0, pos, 0, {}});
|
ret.push_back({0, 0, 0, pos, 0, {}});
|
||||||
|
|
||||||
// unsigned seed =
|
|
||||||
// std::chrono::system_clock::now().time_since_epoch().count();
|
|
||||||
// std::default_random_engine gen(seed);
|
|
||||||
// std::normal_distribution<double> dist(0.0, 25.0);
|
|
||||||
|
|
||||||
// add some gaussian noise
|
|
||||||
// pos.setX(pos.getX() + dist(gen));
|
|
||||||
// pos.setY(pos.getY() + dist(gen));
|
|
||||||
|
|
||||||
double maxMDist = _motCfg.osmBuildOpts.maxStationCandDistance;
|
double maxMDist = _motCfg.osmBuildOpts.maxStationCandDistance;
|
||||||
|
|
||||||
double distor = util::geo::latLngDistFactor(pos);
|
double distor = util::geo::latLngDistFactor(pos);
|
||||||
|
|
||||||
|
if (_cfg.gaussianNoise > 0) {
|
||||||
|
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
|
||||||
|
std::default_random_engine gen(seed);
|
||||||
|
|
||||||
|
// the standard dev is given in meters, convert (roughly...) to degrees
|
||||||
|
double standardDev = (_cfg.gaussianNoise / M_PER_DEG) / distor;
|
||||||
|
|
||||||
|
// mean 0 (no movement), standard dev according to config
|
||||||
|
std::normal_distribution<double> dist(0.0, standardDev);
|
||||||
|
|
||||||
|
// add gaussian noise
|
||||||
|
pos.setX(pos.getX() + dist(gen));
|
||||||
|
pos.setY(pos.getY() + dist(gen));
|
||||||
|
}
|
||||||
|
|
||||||
std::set<trgraph::Node*> frNIdx;
|
std::set<trgraph::Node*> frNIdx;
|
||||||
_nGrid.get(util::geo::pad(util::geo::getBoundingBox(pos),
|
_nGrid.get(util::geo::pad(util::geo::getBoundingBox(pos),
|
||||||
(maxMDist / M_PER_DEG) / distor),
|
(maxMDist / M_PER_DEG) / distor),
|
||||||
|
@ -594,7 +600,7 @@ ad::cppgtfs::gtfs::Shape ShapeBuilder::getGtfsShape(
|
||||||
std::string ShapeBuilder::getFreeShapeId(Trip* trip) {
|
std::string ShapeBuilder::getFreeShapeId(Trip* trip) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
std::lock_guard<std::mutex> guard(_shpMutex);
|
std::lock_guard<std::mutex> guard(_shpMutex);
|
||||||
while (!ret.size() || _feed->getShapes().get(ret)) {
|
while (!ret.size() || _feed->getShapes().has(ret)) {
|
||||||
_curShpCnt++;
|
_curShpCnt++;
|
||||||
ret = "shp_";
|
ret = "shp_";
|
||||||
ret += std::to_string(trip->getRoute()->getType());
|
ret += std::to_string(trip->getRoute()->getType());
|
||||||
|
|
|
@ -169,7 +169,7 @@ std::vector<LINE> Collector::segmentize(const Trip* t, const LINE& shape,
|
||||||
// 5) As tracks are often longer than 20 meters, this will dillute our AN
|
// 5) As tracks are often longer than 20 meters, this will dillute our AN
|
||||||
// measure, although the shape is CORRECT (because the ground truth uses
|
// measure, although the shape is CORRECT (because the ground truth uses
|
||||||
// a different position philosophy than the test data)
|
// a different position philosophy than the test data)
|
||||||
// 6) To normalize this, we always the following approach:
|
// 6) To normalize this, we use the following approach:
|
||||||
// a) Get the exact progression of the measurment on the shape
|
// a) Get the exact progression of the measurment on the shape
|
||||||
// b) Extract a segment of 200 meters, with the measurement progress in
|
// b) Extract a segment of 200 meters, with the measurement progress in
|
||||||
// the middle c) Project the GROUND TRUTH station coordinate to this
|
// the middle c) Project the GROUND TRUTH station coordinate to this
|
||||||
|
|
|
@ -56,8 +56,11 @@ void eval(const std::vector<std::string>* paths,
|
||||||
for (const auto& oldTrip : evalFeed->getTrips()) {
|
for (const auto& oldTrip : evalFeed->getTrips()) {
|
||||||
if (!mots->count(oldTrip.second->getRoute()->getType())) continue;
|
if (!mots->count(oldTrip.second->getRoute()->getType())) continue;
|
||||||
auto newTrip = feed.getTrips().get(oldTrip.first);
|
auto newTrip = feed.getTrips().get(oldTrip.first);
|
||||||
if (!newTrip)
|
if (!newTrip) {
|
||||||
LOG(ERROR) << "Trip #" << oldTrip.first << " not present in " << path;
|
LOG(ERROR) << "Trip #" << oldTrip.first << " not present in " << path
|
||||||
|
<< ", skipping...";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
(*colls)[myFeed].add(oldTrip.second, oldTrip.second->getShape(), newTrip,
|
(*colls)[myFeed].add(oldTrip.second, oldTrip.second->getShape(), newTrip,
|
||||||
newTrip->getShape());
|
newTrip->getShape());
|
||||||
}
|
}
|
||||||
|
@ -121,6 +124,7 @@ int main(int argc, char** argv) {
|
||||||
evlFeedPaths.push_back(feedPath);
|
evlFeedPaths.push_back(feedPath);
|
||||||
if (fullReportPath.size()) {
|
if (fullReportPath.size()) {
|
||||||
reportStreams.emplace_back();
|
reportStreams.emplace_back();
|
||||||
|
reportStreams.back().exceptions(std::ios::failbit | std::ios::badbit);
|
||||||
reportStreams.back().open(fullReportPath + "/" +
|
reportStreams.back().open(fullReportPath + "/" +
|
||||||
util::split(feedPath, '/').back() +
|
util::split(feedPath, '/').back() +
|
||||||
".fullreport.tsv");
|
".fullreport.tsv");
|
||||||
|
|
Loading…
Reference in a new issue