Compare commits

...

47 Commits

Author SHA1 Message Date
Patrick Niklaus 4370fd126d Final version bump 2017-04-21 08:49:00 +00:00
Patrick Niklaus 15a2fdd1f8 Update changelog 2017-04-20 13:58:29 +00:00
Patrick Niklaus 0eedcf69bc Fix checking columns if route is not specified 2017-04-20 13:52:23 +00:00
Patrick Niklaus 62abea30f5 Apply traffic light penalty also for non-turns 2017-04-20 13:52:11 +00:00
Michael Krasnyk 3364be1860 Fix incorrect weight fallback for distance-based weights 2017-04-20 13:51:59 +00:00
Patrick Niklaus a5eeca9b51 Bump version to RC3 2017-04-18 17:09:49 +00:00
Michael Krasnyk 1a09ff6005 Don't remove the last original coordinate during tiding 2017-04-18 13:36:28 +00:00
Patrick Niklaus 2794a52902 Remove boost::make_unique to fix travis node builds 2017-04-13 21:18:08 +00:00
Patrick Niklaus cb796e4cfc Use .gitignore default instead of .npmignore 2017-04-13 21:17:58 +00:00
Patrick Niklaus 522ec4fc2e Restructure travis build 2017-04-13 21:17:45 +00:00
Michael Krasnyk 15dc5899b0 Use total angle for turn instruction if entry step has large distance 2017-04-12 23:32:12 +00:00
Patrick Niklaus 7e932ffbc3 Bump package version 2017-04-12 22:58:58 +00:00
Patrick Niklaus 810596bb83 Install node version as well 2017-04-12 20:28:19 +00:00
Patrick Niklaus acabf0075c Only use three jobs for node builds 2017-04-12 20:28:05 +00:00
Patrick Niklaus 1ed72db210 Use nvm instead of travis node_js key
This fixes issues on container builds that would always use
node 6 even when 4 was specified.
2017-04-12 20:27:53 +00:00
Patrick Niklaus 6bdf95dfb4 Change version to RC1 2017-04-12 14:58:51 +00:00
Patrick Niklaus 785ae89cd8 Update changelog 2017-04-12 14:58:25 +00:00
Patrick Niklaus 16680191de Enable 5.7 branch in travis 2017-04-12 14:28:37 +00:00
Michael Krasnyk 59b70c4d11 Make CoreCH SearchEngineData inherited from CH one
this allows to keep a single Algorithm template parameter in internal
interfaces as

template <typename Algorithm>
search(SearchEngineData<Algorithm> &,
       const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &, ...)
2017-04-12 10:54:09 +00:00
Michael Krasnyk f96bae40ac Remove unused {forward,reverse}_heap_2 in MLD engine data 2017-04-12 10:54:09 +00:00
Michael Krasnyk ba974c73bf Remove CoreCH heaps 2017-04-12 10:54:09 +00:00
Michael Krasnyk e498ad3ee7 Make explicit fallback to CH heaps in CoreCH algorithms 2017-04-12 10:54:09 +00:00
Michael Krasnyk 1de031ed06 Remove {forward,reverse}_core_heap arguments from search interface 2017-04-12 10:54:09 +00:00
Patrick Niklaus d6ac924b94 Use Date.now() 2017-04-11 22:33:38 +00:00
Patrick Niklaus ee24473cbb Always print node version 2017-04-11 22:33:38 +00:00
Patrick Niklaus c19a3cec1c Fix build syntax 2017-04-11 22:33:38 +00:00
Patrick Niklaus f3694be1a0 Override install and after_sucess 2017-04-11 22:33:38 +00:00
Patrick Niklaus 306d86ce58 Add missing semi-colon 2017-04-11 22:33:38 +00:00
Patrick Niklaus 2c001b63a5 Port timer script to JS 2017-04-11 22:33:38 +00:00
Patrick Niklaus e162dda836 Don't use bc 2017-04-11 22:33:38 +00:00
Patrick Niklaus 10c532bd4c Revert "Skip cucumber tests for publish builds"
This reverts commit 3f8160c156.
2017-04-11 22:33:38 +00:00
Patrick Niklaus c8a7bc1d6a Revert "Don't build unit tests for publishing job"
This reverts commit eb0bd378ae.
2017-04-11 22:33:38 +00:00
Patrick Niklaus 9ca3c69b49 Don't build unit tests for publishing job 2017-04-11 22:33:38 +00:00
Patrick Niklaus d1cf8c1fd5 Skip cucumber tests for publish builds 2017-04-11 22:33:38 +00:00
Patrick Niklaus 018742f50f Constrain the number of jobs on container builds 2017-04-11 22:33:38 +00:00
Patrick Niklaus b82d21f856 Install yarn when not there 2017-04-11 22:33:38 +00:00
Patrick Niklaus cfaadf198f Attempt sudo:false build matrix for node 2017-04-11 22:33:38 +00:00
Michael Krasnyk 6698b5e07e Use fallbacks counter to print a single warning message 2017-04-11 14:55:56 +00:00
Michael Krasnyk 37794a5e8a Change traffic CSV field value from weight to rate
and make the value required.

If the weight name is 'duration' than the rate value
can be computed as speed / 3.6

Issue: https://github.com/Project-OSRM/osrm-backend/issues/3823
2017-04-11 14:55:56 +00:00
Patrick Niklaus a88fef2937 Implement distance pruning for MLD as well 2017-04-10 17:25:55 +00:00
Patrick Niklaus da474a16a9 Fix formating 2017-04-10 17:25:02 +00:00
Patrick Niklaus 59bbfeb67f Buffer turn data on disk to save memory 2017-04-10 17:25:02 +00:00
Patrick Niklaus 4e9e2ed5bd Emit a notification when turning on a ferry and don't merge step 2017-04-07 15:29:53 +00:00
Moritz Kobitzsch e0593c7ca2 add failing test for 3762 2017-04-07 15:29:53 +00:00
Daniel J. Hofmann 1f69df0d89 We need bash for the install script 2017-04-07 14:48:57 +02:00
Patrick Niklaus 05706879a0 Less is more: Don't force any specific build configuration 2017-04-07 14:48:57 +02:00
Patrick Niklaus 7e49b36198 Add script to fall back to source build 2017-04-07 14:48:57 +02:00
47 changed files with 746 additions and 534 deletions
+2
View File
@@ -7,6 +7,8 @@
#############################
osrm-deps
.ycm_extra_conf.py
# Compiled source #
###################
*.com
-10
View File
@@ -1,10 +0,0 @@
*
!README.md
!CHANGELOG.md
!CONTRIBUTING.MD
!LICENCE.TXT
!package.json
!example
!lib/*.js
!profiles/*
!profiles/lib/*
+129 -24
View File
@@ -7,8 +7,9 @@ git:
sudo: required
dist: trusty
nodejs:
node_js:
- "4"
- "6"
notifications:
email: false
@@ -16,6 +17,7 @@ notifications:
branches:
only:
- master
- "5.7"
# enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
@@ -36,6 +38,8 @@ env:
- CCACHE_VERSION=3.3.1
- CMAKE_VERSION=3.7.2
- MASON="$(pwd)/scripts/mason.sh"
- ENABLE_NODE_BINDINGS=On
- NODE="4"
matrix:
fast_finish: true
@@ -45,12 +49,14 @@ matrix:
# Debug Builds
- os: linux
compiler: "gcc-6-debug"
compiler: "gcc-6-debug-cov-asan"
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON
after_success:
- bash <(curl -s https://codecov.io/bash)
- os: linux
compiler: "clang-4.0-debug"
@@ -61,12 +67,12 @@ matrix:
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux
compiler: "mason-linux-debug-santize"
compiler: "mason-linux-debug-asan"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON ENABLE_NODE_BINDINGS=ON
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON
# Release Builds
- os: linux
@@ -75,7 +81,7 @@ matrix:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
- os: linux
compiler: "gcc-6-release"
@@ -104,6 +110,8 @@ matrix:
compiler: "mason-osx-release"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON
after_success:
- ./scripts/travis/publish.sh
# Disabled because of CI slowness
#- os: linux
@@ -132,11 +140,112 @@ matrix:
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests.
- os: linux
sudo: false
compiler: "node-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-6-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3 NODE="6"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-6-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3 NODE="6"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
before_install:
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- node --version
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export JOBS=$((`nproc` + 1))
if [[ -z $JOBS ]]; then
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export JOBS=$((`nproc` + 1))
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export JOBS=$((`sysctl -n hw.ncpu` + 1))
fi
fi
- |
if [ -n "${RUN_CLANG_FORMAT}" ]; then
@@ -144,8 +253,10 @@ before_install:
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export JOBS=$((`sysctl -n hw.ncpu` + 1))
sudo mdutil -i off /
fi
- |
if [[ ! -f $(which yarn) ]]; then
npm install -g yarn
fi
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
@@ -173,15 +284,17 @@ before_install:
fi
fi
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
- export OSRM_INSTALL_DIR="$(pwd)/install-osrm"
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- mkdir ${OSRM_BUILD_DIR}
install:
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
./scripts/check_taginfo.py taginfo.json profiles/car.lua
fi
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- mkdir ${OSRM_BUILD_DIR} && pushd ${OSRM_BUILD_DIR}
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
@@ -191,7 +304,8 @@ install:
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- echo "travis_fold:start:MAKE"
- make --jobs=${JOBS}
- make tests --jobs=${JOBS}
@@ -201,10 +315,11 @@ install:
- sudo make install
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
sudo ldconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib
fi
- popd
- mkdir example/build && pushd example/build
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make --jobs=${JOBS}
- popd
@@ -224,19 +339,9 @@ script:
- ./unit_tests/server-tests
- ./unit_tests/partition-tests
- |
if [ -n "${ENABLE_NODE_BINDINGS}" ] && [ -z "${ENABLE_SANITIZER}" ]; then
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests
fi
- popd
- yarn test
after_success:
- |
if [ -n "${ENABLE_COVERAGE}" ]; then
bash <(curl -s https://codecov.io/bash)
fi
- |
if [ -n "${ENABLE_NODE_BINDINGS}" ]; then
./scripts/travis/publish.sh
fi
+17 -2
View File
@@ -1,17 +1,32 @@
- Track preprocessing flag in the map matching plugin.
# 5.7.0
- Changes from 5.6
- Bug fixes:
- Fixed 505: Invalid distance value for distance as routing weight.
- Fixed 3958: Fix traffic light penalties for non-turns
- Fixed 3933: crash when collapsing instructions
- Algorithm:
- OSRM object has new option `algorithm` that allows the selection of a routing algorithm.
- New experimental algorithm: Multi-Level Dijkstra with new toolchain:
- Allows for fast metric updates in below a minute on continental sized networks (osrm-customize)
- Plugins supported: `match` and `route`
- Quickstart: `osrm-extract data.osm.pbf`, `osrm-partition data.osrm`, `osrm-customize data.osrm`, `osrm-routed --algorithm=MLD data.osrm`
- NodeJs Bindings
- Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`.
- `OSRM` object has new option `algorihtm="CH","CoreCH","MLD"`
- Internals
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
- Files
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
- `osrm-extract` creates new file `.osrm.cnbg` and `.cnbg_to_ebg`
- `osrm-partition` creates new file `.osrm.partition` and `.osrm.cells`
- `osrm-customize` creates new file `.osrm.mldgr`
- Profiles
- Added `force_split_edges` flag to global properties. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
- Map Matching:
- new option `gaps=split|ignore` to enable/disbale track splitting
- new option `tidy=true|false` to simplify traces automatically
# 5.6.3
- Changes from 5.6.0
@@ -0,0 +1,39 @@
@routing @car @traffic_light
Feature: Car - Handle traffic lights
Background:
Given the profile "car"
Scenario: Car - Encounters a traffic light
Given the node map
"""
a-1-b-2-c
d-3-e-4-f
g-h-i k-l-m
| |
j n
"""
And the ways
| nodes | highway |
| abc | primary |
| def | primary |
| ghi | primary |
| klm | primary |
| hj | primary |
| ln | primary |
And the nodes
| node | highway |
| e | traffic_signals |
| l | traffic_signals |
When I route I should get
| from | to | time | # |
| 1 | 2 | 11.1s | no turn with no traffic light |
| 3 | 4 | 13.1s | no turn with traffic light |
| g | j | 18.7s | turn with no traffic light |
| k | n | 20.7s | turn with traffic light |
+25
View File
@@ -62,3 +62,28 @@ Feature: Car - weights
| from | to | route | speed | weight |
| a | d | ab,bc,cd,cd | 65 km/h | 44.4 |
| a | e | ab,be,be | 14 km/h | 112 |
Scenario: Distance weights
Given the profile file "car" extended with
"""
api_version = 1
properties.weight_name = 'distance'
"""
Given the node map
"""
a---b---c
|
d
"""
And the ways
| nodes |
| abc |
| bd |
When I route I should get
| waypoints | bearings | route | distance | weights | times |
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s |
+36
View File
@@ -1019,3 +1019,39 @@ Feature: Collapse
| a,g | road,cross,cross | depart,fork left,arrive | a,b,g |
| a,e | road,road,road | depart,fork slight right,arrive | a,b,e |
| a,f | road,road,cross,cross | depart,fork slight right,turn right,arrive | a,b,d,f |
# http://www.openstreetmap.org/way/92415447 #3933
Scenario: Use total angle for turn instruction if entry step has large distance
# """
# kf-_ a
# | - b
# | c
# |d
# e
# |
# i
# """
And the node locations
| node | lat | lon | #id |
| a | -33.9644254 | 151.1378673 | 33226063 |
| b | -33.9644373 | 151.1377172 | 1072787030 |
| c | -33.9644791 | 151.1374452 | 4222903609 |
| d | -33.9645661 | 151.1372654 | 4222903610 |
| e | -33.9646986 | 151.1371539 | 4222903611 |
| f | -33.964386 | 151.1372133 | 1072786875 |
| i | -33.9661796 | 151.1368491 | 2781176918 |
| k | -33.9643781 | 151.1371422 | 1684173853 |
And the ways
| nodes | highway | name | oneway | #id |
| ab | trunk | President Avenue | yes | 92415447 |
| bcde | trunk | President Avenue | yes | 422534457 |
| bf | trunk | President Avenue | yes | 447779786 |
| fk | trunk | President Avenue | yes | 179293012 |
| fei | trunk | Princes Highway | yes | 130099670 |
When I route I should get
| waypoints | route | turns | locations |
| a,i | President Avenue,Princes Highway,Princes Highway | depart,turn left,arrive | a,b,i |
+26
View File
@@ -681,3 +681,29 @@ Feature: Basic Roundabout
| u,r | ug,ar,ar | depart,roundabout-exit-3,arrive |
| u,s | ug,ds,ds | depart,roundabout-exit-4,arrive |
| u,t | ug,ft,ft | depart,roundabout-exit-5,arrive |
@3762
Scenario: Only Enter
Given the node map
"""
a
b
i c e ~ ~ ~ f - h
j d
k g
"""
And the ways
| nodes | junction | route |
| ab | | |
| ef | | ferry |
| fh | | |
| dg | | |
| ic | | |
| jk | | |
| bcjdeb | roundabout | |
When I route I should get
| waypoints | route | turns |
| a,h | ab,ef,ef,fh,fh | depart,roundabout-exit-4,notification slight right,notification straight,arrive |
@@ -22,9 +22,28 @@ Feature: osrm-contract command line option: edge-weight-updates-over-factor
Scenario: Logging weight with updates over factor of 2, long segment
When I run "osrm-extract --profile {profile_file} {osm_file} --generate-edge-lookup"
When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}"
Then stderr should not contain "Speed values were used to update 2 segment(s)"
And stderr should contain "Segment: 1,2"
And stderr should contain "Segment: 1,3"
And I route I should get
| from | to | route | speed |
| a | b | ab,ab | 100 km/h |
| a | c | ac,ac | 100 km/h |
Scenario: Logging using weigts as durations for non-duration profile
Given the profile file "testbot" extended with
"""
properties.weight_name = 'steps'
function way_function(way, result)
result.forward_mode = mode.driving
result.backward_mode = mode.driving
result.weight = 1
result.duration = 1
end
"""
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file} --generate-edge-lookup"
When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}"
Then stderr should contain "Speed values were used to update 2 segments for 'steps' profile"
+94 -94
View File
@@ -79,102 +79,102 @@ module.exports = function () {
if (headers.has('route')) {
got.route = (instructions || '').trim();
if (headers.has('summary')) {
got.summary = (summary || '').trim();
}
if (headers.has('alternative')) {
// TODO examine more than first alternative?
got.alternative ='';
if (json.routes && json.routes.length > 1)
got.alternative = this.wayList(json.routes[1]);
}
var distance = hasRoute && json.routes[0].distance,
time = hasRoute && json.routes[0].duration,
weight = hasRoute && json.routes[0].weight;
if (headers.has('distance')) {
if (row.distance.length) {
if (!row.distance.match(/\d+m/))
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
got.distance = instructions ? util.format('%dm', distance) : '';
} else {
got.distance = '';
}
}
if (headers.has('weight')) {
if (row.weight.length) {
if (!row.weight.match(/[\d\.]+/))
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
got.weight = instructions ? util.format('%d', weight) : '';
} else {
got.weight = '';
}
}
if (headers.has('time')) {
if (!row.time.match(/\d+s/))
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
got.time = instructions ? util.format('%ds', time) : '';
}
if (headers.has('lanes')) {
got.lanes = (lanes || '').trim();
}
if (headers.has('speed')) {
if (row.speed !== '' && instructions) {
if (!row.speed.match(/\d+ km\/h/))
cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)'));
var speed = time > 0 ? Math.round(3.6*distance/time) : null;
got.speed = util.format('%d km/h', speed);
} else {
got.speed = '';
}
}
if (headers.has('intersections')) {
got.intersections = (intersections || '').trim();
}
if (headers.has('locations')){
got.locations = (locations || '').trim();
}
// if header matches 'a:*', parse out the values for *
// and return in that header
headers.forEach((k) => {
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
if (k.match(/^a:/)) {
let a_type = k.slice(2);
if (whitelist.indexOf(a_type) == -1)
return cb(new Error('Unrecognized annotation field', a_type));
if (annotation && !annotation[a_type])
return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation && annotation[a_type] || '';
}
});
var putValue = (key, value) => {
if (headers.has(key)) got[key] = instructions ? value : '';
};
putValue('ref', refs);
putValue('bearing', bearings);
putValue('turns', turns);
putValue('modes', modes);
putValue('times', times);
putValue('distances', distances);
putValue('pronunciations', pronunciations);
putValue('destinations', destinations);
putValue('weight_name', weight_name);
putValue('weights', weights);
putValue('weight', weight);
}
if (headers.has('summary')) {
got.summary = (summary || '').trim();
}
if (headers.has('alternative')) {
// TODO examine more than first alternative?
got.alternative ='';
if (json.routes && json.routes.length > 1)
got.alternative = this.wayList(json.routes[1]);
}
var distance = hasRoute && json.routes[0].distance,
time = hasRoute && json.routes[0].duration,
weight = hasRoute && json.routes[0].weight;
if (headers.has('distance')) {
if (row.distance.length) {
if (!row.distance.match(/\d+m/))
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
got.distance = instructions ? util.format('%dm', distance) : '';
} else {
got.distance = '';
}
}
if (headers.has('weight')) {
if (row.weight.length) {
if (!row.weight.match(/[\d\.]+/))
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
got.weight = instructions ? util.format('%d', weight) : '';
} else {
got.weight = '';
}
}
if (headers.has('time')) {
if (!row.time.match(/\d+s/))
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
got.time = instructions ? util.format('%ds', time) : '';
}
if (headers.has('lanes')) {
got.lanes = (lanes || '').trim();
}
if (headers.has('speed')) {
if (row.speed !== '' && instructions) {
if (!row.speed.match(/\d+ km\/h/))
cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)'));
var speed = time > 0 ? Math.round(3.6*distance/time) : null;
got.speed = util.format('%d km/h', speed);
} else {
got.speed = '';
}
}
if (headers.has('intersections')) {
got.intersections = (intersections || '').trim();
}
if (headers.has('locations')){
got.locations = (locations || '').trim();
}
// if header matches 'a:*', parse out the values for *
// and return in that header
headers.forEach((k) => {
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
if (k.match(/^a:/)) {
let a_type = k.slice(2);
if (whitelist.indexOf(a_type) == -1)
return cb(new Error('Unrecognized annotation field', a_type));
if (annotation && !annotation[a_type])
return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation && annotation[a_type] || '';
}
});
var putValue = (key, value) => {
if (headers.has(key)) got[key] = instructions ? value : '';
};
putValue('ref', refs);
putValue('bearing', bearings);
putValue('turns', turns);
putValue('modes', modes);
putValue('times', times);
putValue('distances', distances);
putValue('pronunciations', pronunciations);
putValue('destinations', destinations);
putValue('weight_name', weight_name);
putValue('weights', weights);
putValue('weight', weight);
for (var key in row) {
if (this.FuzzyMatch.match(got[key], row[key])) {
got[key] = row[key];
+2 -2
View File
@@ -213,7 +213,7 @@ Feature: Basic Map Matching
And the speed file
"""
1,2,36
1,2,36,10
"""
And the contract extra arguments "--segment-speed-file {speeds_file}"
@@ -240,7 +240,7 @@ Feature: Basic Map Matching
And the speed file
"""
1,2,36
1,2,36,10
"""
And the contract extra arguments "--segment-speed-file {speeds_file}"
+29 -29
View File
@@ -30,12 +30,12 @@ Feature: Traffic - speeds
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,0
2,1,0
2,3,27
3,2,27
1,4,27
4,1,27
1,2,0,0
2,1,0,0
2,3,27,7.5
3,2,27,7.5
1,4,27,7.5
4,1,27,7.5
"""
And the query options
| annotations | datasources |
@@ -56,12 +56,12 @@ Feature: Traffic - speeds
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,1,20020.7
2,1,1,20020.7
2,3,27,741.5
3,2,27,741.5
1,4,27,1275.7
4,1,27,1275.7
1,2,1,0.2777777
2,1,1
2,3,27
3,2,27,7.5
1,4,27,7.5
4,1,27,7.5
"""
And the query options
| annotations | datasources |
@@ -89,26 +89,26 @@ Feature: Traffic - speeds
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,1,20020.789
2,1,1,20020.123
2,3,27,741.56789
3,2,27,741.3
1,4,1,34445.12
4,1,1,34445.3
1,2,1,0.27777777
2,1,1,0.27777777
2,3,27,7.5
3,2,27
1,4,1
4,1,1
"""
And the query options
| annotations | datasources |
When I route I should get
| from | to | route | speed | weights | a:datasources |
| a | b | ab,ab | 1 km/h | 20020.789,0 | 1:0 |
| a | c | ab,bc,bc | 2 km/h | 20020.789,741.568,0 | 1:1:0 |
| b | c | bc,bc | 27 km/h | 741.568,0 | 1:0 |
| a | d | ab,eb,de,de | 2 km/h | 20020.789,378.169,400.415,0 | 1:0:0 |
| a | b | ab,ab | 1 km/h | 20020.735,0 | 1:0 |
| a | c | ab,bc,bc | 2 km/h | 20020.735,741.509,0 | 1:1:0 |
| b | c | bc,bc | 27 km/h | 741.509,0 | 1:0 |
| a | d | ab,eb,de,de | 2 km/h | 20020.735,378.169,400.415,0 | 1:0:0 |
| d | c | dc,dc | 36 km/h | 956.805,0 | 0 |
| g | b | ab,ab | 1 km/h | 10010.392,0 | 1:0 |
| a | g | ab,ab | 1 km/h | 10010.397,0 | 1 |
| g | a | ab,ab | 1 km/h | 10010.064,0 | 1:1 |
| g | b | ab,ab | 1 km/h | 10010.365,0 | 1:0 |
| a | g | ab,ab | 1 km/h | 10010.37,0 | 1 |
| g | a | ab,ab | 1 km/h | 10010.37,0 | 1:1 |
Scenario: Speeds that isolate a single node (a)
@@ -121,10 +121,10 @@ Feature: Traffic - speeds
"""
1,2,0
2,1,0
2,3,27
3,2,27
1,4,0
4,1,0
2,3,27,7.5
3,2,27,7.5
1,4,0,0
4,1,0,0
"""
And the query options
| annotations | true |
+4 -4
View File
@@ -284,8 +284,8 @@ Feature: Weight tests
When I route I should get
| waypoints | route | distance | weights | times |
| a,d | , | 59.9m | 62,0 | 24s,0s |
| a,e | ,, | 60.1m | 68.7,10,0 | 38.5s,11s,0s |
| a,d | , | 59.9m | 20.5,0 | 24s,0s |
| a,e | ,, | 60.1m | 27.2,10,0 | 38.5s,11s,0s |
| d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s |
@traffic @speed
@@ -320,6 +320,6 @@ Feature: Weight tests
When I route I should get
| waypoints | route | distance | weights | times |
| a,d | abcd,abcd | 59.9m | 6.993,0 | 7s,0s |
| a,e | abcd,ce,ce | 60.1m | 6.002,2.002,0 | 6s,2s,0s |
| a,d | abcd,abcd | 59.9m | 6.996,0 | 7s,0s |
| a,e | abcd,ce,ce | 60.1m | 6.005,2.002,0 | 6s,2s,0s |
| d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s |
+8 -4
View File
@@ -80,6 +80,8 @@ inline Result keep_all(const MatchParameters &params)
inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
{
BOOST_ASSERT(!params.coordinates.empty());
Result result;
result.can_be_removed.resize(params.coordinates.size(), false);
@@ -91,10 +93,8 @@ inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
Thresholds running{0., 0};
// Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep
for (std::size_t current = 0; current < params.coordinates.size() - 1; ++current)
for (std::size_t current = 0, next = 1; next < params.coordinates.size() - 1; ++current, ++next)
{
const auto next = current + 1;
auto distance_delta = util::coordinate_calculation::haversineDistance(
params.coordinates[current], params.coordinates[next]);
running.distance_in_meters += distance_delta;
@@ -130,7 +130,11 @@ inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
}
}
BOOST_ASSERT(result.can_be_removed.size() == params.coordinates.size());
// Always use the last coordinate if more than two original coordinates
if (params.coordinates.size() > 1)
{
result.tidied_to_original.push_back(params.coordinates.size() - 1);
}
// We have to filter parallel arrays that may be empty or the exact same size.
// result.parameters contains an empty MatchParameters at this point: conditionally fill.
+1
View File
@@ -123,6 +123,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
private:
SearchEngineData<Algorithm> &heaps;
// Owned by shared-ptr passed to the query
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
};
@@ -21,11 +21,15 @@ namespace routing_algorithms
/// by the previous route.
/// This variation is only an optimazation for graphs with slow queries, for example
/// not fully contracted graphs.
template <typename Algorithm>
InternalRouteResult
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<mld::Algorithm> &engine_working_data,
@@ -350,63 +350,29 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
std::int32_t &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
const PhantomNodes &phantom_nodes,
const int duration_upper_bound = INVALID_EDGE_WEIGHT);
// Alias to be compatible with the overload for CoreCH that needs 4 heaps
inline void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &,
SearchEngineData<Algorithm>::QueryHeap &,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
const PhantomNodes & /*phantom_nodes*/,
const int duration_upper_bound = INVALID_EDGE_WEIGHT)
{
search(facade,
forward_heap,
reverse_heap,
weight,
packed_leg,
force_loop_forward,
force_loop_reverse,
duration_upper_bound);
}
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
// Alias to be compatible with the overload for CoreCH that needs 4 heaps
inline double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &,
SearchEngineData<Algorithm>::QueryHeap &,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT)
{
return getNetworkDistance(
facade, forward_heap, reverse_heap, source_phantom, target_phantom, duration_upper_bound);
}
} // namespace ch
namespace corech
@@ -420,11 +386,10 @@ namespace corech
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
int &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
@@ -436,11 +401,10 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorit
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
@@ -181,11 +181,13 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
template <typename... Args>
std::tuple<EdgeWeight, NodeID, NodeID, std::vector<EdgeID>>
search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const bool force_loop_forward,
const bool force_loop_reverse,
EdgeWeight weight_upper_bound,
Args... args)
{
@@ -196,7 +198,7 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
// run two-Target Dijkstra routing step.
NodeID middle = SPECIAL_NODEID;
EdgeWeight weight = INVALID_EDGE_WEIGHT;
EdgeWeight weight = weight_upper_bound;
EdgeWeight forward_heap_min = forward_heap.MinKey();
EdgeWeight reverse_heap_min = reverse_heap.MinKey();
while (forward_heap.Size() + reverse_heap.Size() > 0 &&
@@ -231,7 +233,7 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
};
// No path found for both target nodes?
if (weight == INVALID_EDGE_WEIGHT || SPECIAL_NODEID == middle)
if (weight >= weight_upper_bound || SPECIAL_NODEID == middle)
{
return std::make_tuple(
INVALID_EDGE_WEIGHT, SPECIAL_NODEID, SPECIAL_NODEID, std::vector<EdgeID>());
@@ -292,11 +294,13 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
NodeID subpath_source, subpath_target;
std::vector<EdgeID> subpath;
std::tie(subpath_weight, subpath_source, subpath_target, subpath) =
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
force_loop_forward,
force_loop_reverse,
INVALID_EDGE_WEIGHT,
sublevel,
parent_cell_id);
BOOST_ASSERT(!subpath.empty());
@@ -309,25 +313,29 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
return std::make_tuple(weight, source_node, target_node, std::move(unpacked_path));
}
// TODO reorder parameters
// Alias to be compatible with the overload for CoreCH that needs 4 heaps for shortest path search
inline void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
inline void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &,
SearchEngineData<Algorithm>::QueryHeap &,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
const PhantomNodes &phantom_nodes,
const int duration_upper_bound = INVALID_EDGE_WEIGHT)
const EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT)
{
(void)duration_upper_bound; // TODO: limiting search radius is not implemented for MLD
NodeID source_node, target_node;
std::vector<EdgeID> unpacked_edges;
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(
facade, forward_heap, reverse_heap, force_loop_forward, force_loop_reverse, phantom_nodes);
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(engine_working_data,
facade,
forward_heap,
reverse_heap,
force_loop_forward,
force_loop_reverse,
weight_upper_bound,
phantom_nodes);
if (weight != INVALID_EDGE_WEIGHT)
{
@@ -367,14 +375,13 @@ void unpackPath(const FacadeT &facade,
}
inline double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap & /*forward_core_heap*/,
SearchEngineData<Algorithm>::QueryHeap & /*reverse_core_heap*/,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int /*duration_upper_bound*/)
EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT)
{
forward_heap.Clear();
reverse_heap.Clear();
@@ -385,8 +392,14 @@ getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorith
EdgeWeight weight;
NodeID source_node, target_node;
std::vector<EdgeID> unpacked_edges;
std::tie(weight, source_node, target_node, unpacked_edges) = search(
facade, forward_heap, reverse_heap, DO_NOT_FORCE_LOOPS, DO_NOT_FORCE_LOOPS, phantom_nodes);
std::tie(weight, source_node, target_node, unpacked_edges) = search(engine_working_data,
facade,
forward_heap,
reverse_heap,
DO_NOT_FORCE_LOOPS,
DO_NOT_FORCE_LOOPS,
weight_upper_bound,
phantom_nodes);
if (weight == INVALID_EDGE_WEIGHT)
return std::numeric_limits<double>::max();
+17 -5
View File
@@ -12,6 +12,16 @@ namespace osrm
namespace engine
{
// Algorithm-dependent heaps
// - CH algorithms use CH heaps
// - CoreCH algorithms use CoreCH heaps that can be upcasted to CH heaps when CH algorithms reused
// by CoreCH at calling ch::routingStep, ch::retrievePackedPathFromSingleHeap and ch::unpackPath
// - MLD algorithms use MLD heaps
template <typename Algorithm> struct SearchEngineData
{
};
struct HeapData
{
NodeID parent;
@@ -24,7 +34,7 @@ struct ManyToManyHeapData : HeapData
ManyToManyHeapData(NodeID p, EdgeWeight duration) : HeapData(p), duration(duration) {}
};
template <typename Algorithm> struct SearchEngineData
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
{
using QueryHeap = util::
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
@@ -55,6 +65,12 @@ template <typename Algorithm> struct SearchEngineData
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
};
template <>
struct SearchEngineData<routing_algorithms::corech::Algorithm>
: public SearchEngineData<routing_algorithms::ch::Algorithm>
{
};
struct MultiLayerDijkstraHeapData
{
NodeID parent;
@@ -75,12 +91,8 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
static SearchEngineHeapPtr forward_heap_1;
static SearchEngineHeapPtr reverse_heap_1;
static SearchEngineHeapPtr forward_heap_2;
static SearchEngineHeapPtr reverse_heap_2;
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes);
void InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes);
};
}
}
@@ -159,9 +159,6 @@ class EdgeBasedGraphFactory
NBGToEBG InsertEdgeBasedNode(const NodeID u, const NodeID v);
void FlushVectorToStream(storage::io::FileWriter &edge_data_file,
std::vector<OriginalEdgeData> &original_edge_data_vector) const;
std::size_t restricted_turns_counter;
std::size_t skipped_uturns_counter;
std::size_t skipped_barrier_turns_counter;
+4 -2
View File
@@ -117,7 +117,8 @@ template <typename TurnDataT>
inline void readTurnData(const boost::filesystem::path &path, TurnDataT &turn_data)
{
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
std::is_same<TurnDataView, TurnDataT>::value,
std::is_same<TurnDataView, TurnDataT>::value ||
std::is_same<TurnDataExternalContainer, TurnDataT>::value,
"");
const auto fingerprint = storage::io::FileReader::HasNoFingerprint;
storage::io::FileReader reader{path, fingerprint};
@@ -130,7 +131,8 @@ template <typename TurnDataT>
inline void writeTurnData(const boost::filesystem::path &path, const TurnDataT &turn_data)
{
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
std::is_same<TurnDataView, TurnDataT>::value,
std::is_same<TurnDataView, TurnDataT>::value ||
std::is_same<TurnDataExternalContainer, TurnDataT>::value,
"");
const auto fingerprint = storage::io::FileWriter::HasNoFingerprint;
storage::io::FileWriter writer{path, fingerprint};
@@ -122,6 +122,7 @@ template <storage::Ownership Ownership> class TurnDataContainerImpl
};
}
using TurnDataExternalContainer = detail::TurnDataContainerImpl<storage::Ownership::External>;
using TurnDataContainer = detail::TurnDataContainerImpl<storage::Ownership::Container>;
using TurnDataView = detail::TurnDataContainerImpl<storage::Ownership::View>;
}
+7 -8
View File
@@ -18,7 +18,6 @@
#include "osrm/trip_parameters.hpp"
#include <boost/assert.hpp>
#include <boost/make_unique.hpp>
#include <boost/optional.hpp>
#include <algorithm>
@@ -81,7 +80,7 @@ inline void ParseResult(const osrm::Status &result_status, const std::string & /
inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo<v8::Value> &args)
{
Nan::HandleScope scope;
auto engine_config = boost::make_unique<osrm::EngineConfig>();
auto engine_config = std::make_unique<osrm::EngineConfig>();
if (args.Length() == 0)
{
@@ -631,7 +630,7 @@ inline route_parameters_ptr
argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
bool requires_multiple_coordinates)
{
route_parameters_ptr params = boost::make_unique<osrm::RouteParameters>();
route_parameters_ptr params = std::make_unique<osrm::RouteParameters>();
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
if (!has_base_params)
return route_parameters_ptr();
@@ -681,7 +680,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
inline tile_parameters_ptr
argumentsToTileParameters(const Nan::FunctionCallbackInfo<v8::Value> &args, bool /*unused*/)
{
tile_parameters_ptr params = boost::make_unique<osrm::TileParameters>();
tile_parameters_ptr params = std::make_unique<osrm::TileParameters>();
if (args.Length() < 2)
{
@@ -742,7 +741,7 @@ inline nearest_parameters_ptr
argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
bool requires_multiple_coordinates)
{
nearest_parameters_ptr params = boost::make_unique<osrm::NearestParameters>();
nearest_parameters_ptr params = std::make_unique<osrm::NearestParameters>();
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
if (!has_base_params)
return nearest_parameters_ptr();
@@ -781,7 +780,7 @@ inline table_parameters_ptr
argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
bool requires_multiple_coordinates)
{
table_parameters_ptr params = boost::make_unique<osrm::TableParameters>();
table_parameters_ptr params = std::make_unique<osrm::TableParameters>();
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
if (!has_base_params)
return table_parameters_ptr();
@@ -875,7 +874,7 @@ inline trip_parameters_ptr
argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
bool requires_multiple_coordinates)
{
trip_parameters_ptr params = boost::make_unique<osrm::TripParameters>();
trip_parameters_ptr params = std::make_unique<osrm::TripParameters>();
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
if (!has_base_params)
return trip_parameters_ptr();
@@ -970,7 +969,7 @@ inline match_parameters_ptr
argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
bool requires_multiple_coordinates)
{
match_parameters_ptr params = boost::make_unique<osrm::MatchParameters>();
match_parameters_ptr params = std::make_unique<osrm::MatchParameters>();
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
if (!has_base_params)
return match_parameters_ptr();
+23
View File
@@ -1,16 +1,39 @@
#ifndef OSRM_STORAGE_SERIALIZATION_HPP
#define OSRM_STORAGE_SERIALIZATION_HPP
#include "util/integer_range.hpp"
#include "util/vector_view.hpp"
#include "storage/io.hpp"
#include <cstdint>
namespace osrm
{
namespace storage
{
namespace serialization
{
template <typename T> inline void read(storage::io::FileReader &reader, stxxl::vector<T> &vec)
{
auto size = reader.ReadOne<std::uint64_t>();
vec.reserve(size);
for (auto idx : util::irange<std::size_t>(0, size))
{
(void)idx;
vec.push_back(reader.ReadOne<T>());
}
}
template <typename T>
inline void write(storage::io::FileWriter &writer, const stxxl::vector<T> &vec)
{
writer.WriteOne(vec.size());
for (auto idx : util::irange<std::size_t>(0, vec.size()))
{
writer.WriteOne<T>(vec[idx]);
}
}
template <typename T> void read(io::FileReader &reader, std::vector<T> &data)
{
+2 -1
View File
@@ -9,7 +9,8 @@ namespace storage
enum class Ownership
{
Container,
View
View,
External
};
}
}
+2 -2
View File
@@ -49,9 +49,9 @@ struct Segment final
struct SpeedSource final
{
SpeedSource() : speed(0), weight(std::numeric_limits<double>::quiet_NaN()) {}
SpeedSource() : speed(0), rate(std::numeric_limits<double>::quiet_NaN()) {}
unsigned speed;
double weight;
double rate;
std::uint8_t source;
};
+9 -1
View File
@@ -6,6 +6,8 @@
#include "storage/shared_memory_ownership.hpp"
#include <stxxl/vector>
#include <boost/assert.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/reverse_iterator.hpp>
@@ -174,10 +176,16 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
std::swap(lhs.m_size, rhs.m_size);
}
template <typename DataT, storage::Ownership Ownership>
using InternalOrExternalVector =
typename std::conditional<Ownership == storage::Ownership::External,
stxxl::vector<DataT>,
std::vector<DataT>>::type;
template <typename DataT, storage::Ownership Ownership>
using ViewOrVector = typename std::conditional<Ownership == storage::Ownership::View,
vector_view<DataT>,
std::vector<DataT>>::type;
InternalOrExternalVector<DataT, Ownership>>::type;
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.7.0-latest.6",
"version": "5.7.0",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {
@@ -19,7 +19,7 @@
"test": "npm run lint && node ./node_modules/cucumber/bin/cucumber.js features/ -p verify && node ./node_modules/cucumber/bin/cucumber.js features/ -p mld",
"clean": "rm -rf test/cache",
"docs": "./scripts/build_api_docs.sh",
"install": "node-pre-gyp install --fallback-to-build=false",
"install": "node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh",
"nodejs-tests": "make -C test/data && ./lib/binding/osrm-datastore test/data/ch/monaco.osrm && node test/nodejs/index.js | faucet"
},
"repository": {
+6 -6
View File
@@ -392,21 +392,21 @@ function turn_function (turn)
local turn_penalty = profile.turn_penalty
local turn_bias = profile.turn_bias
if turn.has_traffic_light then
turn.duration = profile.traffic_light_penalty
end
if turn.turn_type ~= turn_type.no_turn then
if turn.angle >= 0 then
turn.duration = turn_penalty / (1 + math.exp( -((13 / turn_bias) * turn.angle/180 - 6.5*turn_bias)))
turn.duration = turn.duration + turn_penalty / (1 + math.exp( -((13 / turn_bias) * turn.angle/180 - 6.5*turn_bias)))
else
turn.duration = turn_penalty / (1 + math.exp( -((13 * turn_bias) * -turn.angle/180 - 6.5/turn_bias)))
turn.duration = turn.duration + turn_penalty / (1 + math.exp( -((13 * turn_bias) * -turn.angle/180 - 6.5/turn_bias)))
end
if turn.direction_modifier == direction_modifier.u_turn then
turn.duration = turn.duration + profile.u_turn_penalty
end
if turn.has_traffic_light then
turn.duration = turn.duration + profile.traffic_light_penalty
end
-- for distance based routing we don't want to have penalties based on turn angle
if properties.weight_name == 'distance' then
turn.weight = 0
+1 -1
View File
@@ -441,7 +441,7 @@ end
function Handlers.handle_weights(way,result,data,profile)
if properties.weight_name == 'distance' then
result.weight = 0
result.weight = -1
-- set weight rates to 1 for the distance weight, edge weights are distance / rate
if (result.forward_mode ~= mode.inaccessible and result.forward_speed > 0) then
result.forward_rate = 1
-18
View File
@@ -1,18 +0,0 @@
#!/usr/bin/env bash
NODE_HOME=$HOME/node
export NODE_HOME
mkdir ${NODE_HOME}
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
curl https://s3.amazonaws.com/mapbox/apps/install-node/v2.0.0/run | NV=4.4.2 NP=darwin-x64 OD=${NODE_HOME} sh
else
curl https://s3.amazonaws.com/mapbox/apps/install-node/v2.0.0/run | NV=4.4.2 NP=linux-x64 OD=${NODE_HOME} sh
fi
PATH="${NODE_HOME}/bin:$PATH"
export PATH
node --version
npm --version
which node
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
CMAKE_OPTIONS=${CMAKE_OPTIONS:-"-DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On"}
if [[ ! -f $(which cmake) ]]; then
echo "Needs cmake to build from source"
exit 1
fi
if [[ -d build ]]; then
echo "Detected existing build directory, skipping compiling."
exit 0
else
mkdir -p build
pushd build
cmake .. $CMAKE_OPTIONS
cmake --build .
popd
fi
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env node
var exec = require('child_process').exec;
var fs = require('fs');
var name = process.argv[2];
var cmd = process.argv.slice(3).join(' ');
var start = Date.now();
exec(cmd, (err) => {
if (err) return console.log(err);
var stop = +new Date();
var time = (stop - start) / 1000.;
fs.appendFileSync('/tmp/osrm.timings', `${name}\t${time}`, 'utf-8');
});
-16
View File
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
TIMINGS_FILE=/tmp/osrm.timings
NAME=$1
CMD=${@:2}
START=$(date "+%s.%N")
/bin/bash -c "$CMD"
END=$(date "+%s.%N")
TIME="$(echo "$END - $START" | bc)s"
NEW_ENTRY="$NAME\t$TIME"
echo -e "$NEW_ENTRY" >> $TIMINGS_FILE
+10 -6
View File
@@ -3,15 +3,19 @@
set -eu
set -o pipefail
echo "node version is:"
which node
node -v
if [[ ${PUBLISH} == 'On' ]]; then
echo "PUBLISH is set to '${PUBLISH}', publishing!"
echo "node version is:"
which node
node -v
NPM_FLAGS=''
if [[ ${BUILD_TYPE} == "Debug" ]]; then
NPM_FLAGS='--debug'
fi
echo "dumping binary meta..."
./node_modules/.bin/node-pre-gyp reveal
./node_modules/.bin/node-pre-gyp reveal $NPM_FLAGS
# enforce that binary has proper ORIGIN flags so that
# it can portably find libtbb.so in the same directory
@@ -27,7 +31,7 @@ if [[ ${PUBLISH} == 'On' ]]; then
fi
fi
./node_modules/.bin/node-pre-gyp package publish info
./node_modules/.bin/node-pre-gyp package publish info $NPM_FLAGS
else
echo "PUBLISH is set to '${PUBLISH}', skipping."
fi
-3
View File
@@ -74,9 +74,6 @@ double findTotalTurnAngle(const RouteStep &entry_step, const RouteStep &exit_ste
if (entry_step.distance < MAX_COLLAPSE_DISTANCE)
return true;
if (entry_step.distance > 2 * MAX_COLLAPSE_DISTANCE)
return false;
// both go roughly in the same direction
if ((entry_angle <= 185 && exit_angle <= 185) || (entry_angle >= 175 && exit_angle >= 175))
return true;
+26 -8
View File
@@ -118,12 +118,14 @@ bool setUpRoundabout(RouteStep &step)
void closeOffRoundabout(const bool on_roundabout,
std::vector<RouteStep> &steps,
const std::size_t step_index)
std::size_t step_index)
{
auto &step = steps[step_index];
step.maneuver.exit += 1;
if (!on_roundabout)
{
BOOST_ASSERT(steps.size() >= 2);
// We reached a special case that requires the addition of a special route step in the
// beginning. We started in a roundabout, so to announce the exit, we move use the exit
// instruction and move it right to the beginning to make sure to immediately announce the
@@ -160,6 +162,23 @@ void closeOffRoundabout(const bool on_roundabout,
}
}
if (step_index > 1)
{
auto &exit_step = steps[step_index];
auto &prev_step = steps[step_index - 1];
// In case the step with the roundabout exit instruction cannot be merged with the
// previous step we change the instruction to a normal turn
if (!guidance::haveSameMode(exit_step, prev_step))
{
BOOST_ASSERT(leavesRoundabout(exit_step.maneuver.instruction));
prev_step.maneuver.instruction = exit_step.maneuver.instruction;
if (!entersRoundabout(prev_step.maneuver.instruction))
prev_step.maneuver.exit = exit_step.maneuver.exit;
exit_step.maneuver.instruction.type = TurnType::Notification;
step_index--;
}
}
// Normal exit from the roundabout, or exit from a previously fixed roundabout. Propagate the
// index back to the entering location and prepare the current silent set of instructions for
// removal.
@@ -170,6 +189,7 @@ void closeOffRoundabout(const bool on_roundabout,
const auto exit_intersection = steps[step_index].intersections.front();
const auto exit_bearing = exit_intersection.bearings[exit_intersection.out];
const auto destination_copy = step;
if (step_index > 1)
{
// The very first route-step is head, so we cannot iterate past that one
@@ -177,8 +197,11 @@ void closeOffRoundabout(const bool on_roundabout,
--propagation_index)
{
auto &propagation_step = steps[propagation_index];
propagation_step.ElongateBy(steps[propagation_index + 1]);
propagation_step.maneuver.exit = steps[propagation_index + 1].maneuver.exit;
auto &next_step = steps[propagation_index + 1];
propagation_step.ElongateBy(next_step);
propagation_step.maneuver.exit = next_step.maneuver.exit;
next_step.Invalidate();
if (entersRoundabout(propagation_step.maneuver.instruction))
{
const auto entry_intersection = propagation_step.intersections.front();
@@ -206,13 +229,8 @@ void closeOffRoundabout(const bool on_roundabout,
}
propagation_step.AdaptStepSignage(destination_copy);
steps[propagation_index + 1].Invalidate();
break;
}
else
{
steps[propagation_index + 1].Invalidate();
}
}
// remove exit
}
@@ -62,25 +62,19 @@ InternalRouteResult directShortestPathSearchImpl(
const PhantomNodes &phantom_nodes)
{
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
engine_working_data.InitializeOrClearSecondThreadLocalStorage(facade.GetNumberOfNodes());
auto &forward_heap = *engine_working_data.forward_heap_1;
auto &reverse_heap = *engine_working_data.reverse_heap_1;
auto &forward_core_heap = *engine_working_data.forward_heap_2;
auto &reverse_core_heap = *engine_working_data.reverse_heap_2;
forward_heap.Clear();
reverse_heap.Clear();
forward_core_heap.Clear();
reverse_core_heap.Clear();
EdgeWeight weight = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_leg;
insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes);
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
weight,
packed_leg,
DO_NOT_FORCE_LOOPS,
@@ -107,7 +101,6 @@ InternalRouteResult directShortestPathSearchImpl(
} // namespace ch
template <>
InternalRouteResult directShortestPathSearch(
SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
@@ -116,7 +109,6 @@ InternalRouteResult directShortestPathSearch(
return detail::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes);
}
template <>
InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
@@ -140,8 +132,14 @@ InternalRouteResult directShortestPathSearch(
EdgeWeight weight;
NodeID source_node, target_node;
std::vector<EdgeID> unpacked_edges;
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(
facade, forward_heap, reverse_heap, DO_NOT_FORCE_LOOPS, DO_NOT_FORCE_LOOPS, phantom_nodes);
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(engine_working_data,
facade,
forward_heap,
reverse_heap,
DO_NOT_FORCE_LOOPS,
DO_NOT_FORCE_LOOPS,
INVALID_EDGE_WEIGHT,
phantom_nodes);
return extractRoute(facade, weight, source_node, target_node, unpacked_edges, phantom_nodes);
}
+6 -10
View File
@@ -143,12 +143,9 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
const auto nodes_number = facade.GetNumberOfNodes();
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number);
engine_working_data.InitializeOrClearSecondThreadLocalStorage(nodes_number);
auto &forward_heap = *engine_working_data.forward_heap_1;
auto &reverse_heap = *engine_working_data.reverse_heap_1;
auto &forward_core_heap = *engine_working_data.forward_heap_2;
auto &reverse_core_heap = *engine_working_data.reverse_heap_2;
std::size_t breakage_begin = map_matching::INVALID_STATE;
std::vector<std::size_t> split_points;
@@ -198,9 +195,9 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
const auto haversine_distance = util::coordinate_calculation::haversineDistance(
prev_coordinate, current_coordinate);
// assumes minumum of 0.1 m/s
const int duration_upper_bound =
((haversine_distance + max_distance_delta) * 0.25) * 10;
// assumes minumum of 4 m/s
const EdgeWeight weight_upper_bound =
((haversine_distance + max_distance_delta) / 4.) * facade.GetWeightMultiplier();
// compute d_t for this timestamp and the next one
for (const auto s : util::irange<std::size_t>(0UL, prev_viterbi.size()))
@@ -220,14 +217,13 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
}
double network_distance =
getNetworkDistance(facade,
getNetworkDistance(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
prev_unbroken_timestamps_list[s].phantom_node,
current_timestamps_list[s_prime].phantom_node,
duration_upper_bound);
weight_upper_bound);
// get distance diff between loc1/2 and locs/s_prime
const auto d_t = std::abs(network_distance - haversine_distance);
@@ -71,13 +71,15 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void search(SearchEngineData<Algorithm> & /*engine_working_data*/,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
const PhantomNodes & /*phantom_nodes*/,
const EdgeWeight weight_upper_bound)
{
NodeID middle = SPECIAL_NODEID;
@@ -142,7 +144,8 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
@@ -180,13 +183,15 @@ double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<A
EdgeWeight weight = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_path;
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
weight,
packed_path,
DO_NOT_FORCE_LOOPS,
DO_NOT_FORCE_LOOPS,
{source_phantom, target_phantom},
weight_upper_bound);
if (weight == INVALID_EDGE_WEIGHT)
@@ -216,11 +221,10 @@ namespace corech
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_core_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_core_heap,
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
@@ -285,8 +289,7 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
}
}
const auto insertInCoreHeap = [](const CoreEntryPoint &p,
SearchEngineData<ch::Algorithm>::QueryHeap &core_heap) {
const auto insertInCoreHeap = [](const CoreEntryPoint &p, auto &core_heap) {
NodeID id;
EdgeWeight weight;
NodeID parent;
@@ -295,13 +298,16 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
core_heap.Insert(id, weight, parent);
};
forward_core_heap.Clear();
engine_working_data.InitializeOrClearSecondThreadLocalStorage(facade.GetNumberOfNodes());
auto &forward_core_heap = *engine_working_data.forward_heap_2;
auto &reverse_core_heap = *engine_working_data.reverse_heap_2;
for (const auto &p : forward_entry_points)
{
insertInCoreHeap(p, forward_core_heap);
}
reverse_core_heap.Clear();
for (const auto &p : reverse_entry_points)
{
insertInCoreHeap(p, reverse_core_heap);
@@ -395,29 +401,25 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_core_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_core_heap,
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
EdgeWeight weight_upper_bound)
{
forward_heap.Clear();
reverse_heap.Clear();
forward_core_heap.Clear();
reverse_core_heap.Clear();
insertNodesInHeaps(forward_heap, reverse_heap, {source_phantom, target_phantom});
EdgeWeight weight = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_path;
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
weight,
packed_path,
DO_NOT_FORCE_LOOPS,
+14 -36
View File
@@ -21,11 +21,10 @@ const static constexpr bool DO_NOT_FORCE_LOOP = false;
// allows a uturn at the target_phantom
// searches source forward/reverse -> target forward/reverse
template <typename Algorithm>
void searchWithUTurn(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
typename SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
const bool search_from_forward_node,
const bool search_from_reverse_node,
const bool search_to_forward_node,
@@ -75,15 +74,10 @@ void searchWithUTurn(const datafacade::ContiguousInternalMemoryDataFacade<Algori
auto needs_loop_backwards =
is_oneway_target && needsLoopBackwards(source_phantom, target_phantom);
forward_core_heap.Clear();
reverse_core_heap.Clear();
BOOST_ASSERT(forward_core_heap.Size() == 0);
BOOST_ASSERT(reverse_core_heap.Size() == 0);
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
new_total_weight,
leg_packed_path,
needs_loop_forwards,
@@ -101,11 +95,10 @@ void searchWithUTurn(const datafacade::ContiguousInternalMemoryDataFacade<Algori
// source forward/reverse -> target forward
// source forward/reverse -> target reverse
template <typename Algorithm>
void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
typename SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
const bool search_from_forward_node,
const bool search_from_reverse_node,
const bool search_to_forward_node,
@@ -144,15 +137,10 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
forward_core_heap.Clear();
reverse_core_heap.Clear();
BOOST_ASSERT(forward_core_heap.Size() == 0);
BOOST_ASSERT(reverse_core_heap.Size() == 0);
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
new_total_weight_to_forward,
leg_packed_path_forward,
needsLoopForward(source_phantom, target_phantom),
@@ -183,15 +171,10 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
forward_core_heap.Clear();
reverse_core_heap.Clear();
BOOST_ASSERT(forward_core_heap.Size() == 0);
BOOST_ASSERT(reverse_core_heap.Size() == 0);
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
new_total_weight_to_reverse,
leg_packed_path_reverse,
routing_algorithms::DO_NOT_FORCE_LOOP,
@@ -246,12 +229,9 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
: facade.GetContinueStraightDefault());
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
engine_working_data.InitializeOrClearSecondThreadLocalStorage(facade.GetNumberOfNodes());
auto &forward_heap = *engine_working_data.forward_heap_1;
auto &reverse_heap = *engine_working_data.reverse_heap_1;
auto &forward_core_heap = *engine_working_data.forward_heap_2;
auto &reverse_core_heap = *engine_working_data.reverse_heap_2;
int total_weight_to_forward = 0;
int total_weight_to_reverse = 0;
@@ -294,11 +274,10 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
{
if (allow_uturn_at_waypoint)
{
searchWithUTurn(facade,
searchWithUTurn(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
search_from_forward_node,
search_from_reverse_node,
search_to_forward_node,
@@ -331,11 +310,10 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
}
else
{
search(facade,
search(engine_working_data,
facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
search_from_forward_node,
search_from_reverse_node,
search_to_forward_node,
+13 -99
View File
@@ -7,30 +7,17 @@ namespace osrm
namespace engine
{
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::forward_heap_1;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::reverse_heap_1;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::forward_heap_2;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::reverse_heap_2;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::forward_heap_3;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
SearchEngineData<Algorithm>::reverse_heap_3;
template <typename Algorithm>
typename SearchEngineData<Algorithm>::ManyToManyHeapPtr
SearchEngineData<Algorithm>::many_to_many_heap;
// CH heaps
using CH = routing_algorithms::ch::Algorithm;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
template <typename Algorithm>
void SearchEngineData<Algorithm>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes)
void SearchEngineData<CH>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes)
{
if (forward_heap_1.get())
{
@@ -51,9 +38,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearFirstThreadLocalStorage(unsig
}
}
template <typename Algorithm>
void SearchEngineData<Algorithm>::InitializeOrClearSecondThreadLocalStorage(
unsigned number_of_nodes)
void SearchEngineData<CH>::InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes)
{
if (forward_heap_2.get())
{
@@ -74,8 +59,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearSecondThreadLocalStorage(
}
}
template <typename Algorithm>
void SearchEngineData<Algorithm>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes)
void SearchEngineData<CH>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes)
{
if (forward_heap_3.get())
{
@@ -96,9 +80,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearThirdThreadLocalStorage(unsig
}
}
template <typename Algorithm>
void SearchEngineData<Algorithm>::InitializeOrClearManyToManyThreadLocalStorage(
unsigned number_of_nodes)
void SearchEngineData<CH>::InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes)
{
if (many_to_many_heap.get())
{
@@ -110,57 +92,10 @@ void SearchEngineData<Algorithm>::InitializeOrClearManyToManyThreadLocalStorage(
}
}
// CH
using CH = routing_algorithms::ch::Algorithm;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
template SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
template SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
template void
SearchEngineData<routing_algorithms::ch::Algorithm>::InitializeOrClearFirstThreadLocalStorage(
unsigned number_of_nodes);
template void
SearchEngineData<CH>::InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes);
template void
SearchEngineData<CH>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes);
template void
SearchEngineData<CH>::InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
// CoreCH
using CoreCH = routing_algorithms::corech::Algorithm;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::forward_heap_1;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::reverse_heap_1;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::forward_heap_2;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::reverse_heap_2;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::forward_heap_3;
template SearchEngineData<CoreCH>::SearchEngineHeapPtr SearchEngineData<CoreCH>::reverse_heap_3;
template SearchEngineData<CoreCH>::ManyToManyHeapPtr SearchEngineData<CoreCH>::many_to_many_heap;
template void
SearchEngineData<CoreCH>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes);
template void
SearchEngineData<CoreCH>::InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes);
template void
SearchEngineData<CoreCH>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes);
template void
SearchEngineData<CoreCH>::InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
// MLD
using MLD = routing_algorithms::mld::Algorithm;
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_1;
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_2;
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_2;
void SearchEngineData<MLD>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes)
{
@@ -182,26 +117,5 @@ void SearchEngineData<MLD>::InitializeOrClearFirstThreadLocalStorage(unsigned nu
reverse_heap_1.reset(new QueryHeap(number_of_nodes));
}
}
void SearchEngineData<MLD>::InitializeOrClearSecondThreadLocalStorage(unsigned)
{
if (forward_heap_2.get())
{
forward_heap_2->Clear();
}
else
{
forward_heap_2.reset(new QueryHeap(1));
}
if (reverse_heap_2.get())
{
reverse_heap_2->Clear();
}
else
{
reverse_heap_2.reset(new QueryHeap(1));
}
}
}
}
+1 -2
View File
@@ -309,8 +309,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
storage::io::FileWriter turn_penalties_index_file(turn_penalties_index_filename,
storage::io::FileWriter::HasNoFingerprint);
// TODO investigate increased peak memory consumption by keeping this in memory now
TurnDataContainer turn_data_container;
TurnDataExternalContainer turn_data_container;
// Loop over all turns and generate new set of edges.
// Three nested loop look super-linear, but we are dealing with a (kind of)
+1 -1
View File
@@ -11,7 +11,7 @@ BOOST_FUSION_ADAPT_STRUCT(osrm::updater::Segment,
(decltype(osrm::updater::Segment::to), to))
BOOST_FUSION_ADAPT_STRUCT(osrm::updater::SpeedSource,
(decltype(osrm::updater::SpeedSource::speed), speed)
(decltype(osrm::updater::SpeedSource::weight), weight))
(decltype(osrm::updater::SpeedSource::rate), rate))
BOOST_FUSION_ADAPT_STRUCT(osrm::updater::Turn,
(decltype(osrm::updater::Turn::from), from)
(decltype(osrm::updater::Turn::via), via)
+36 -22
View File
@@ -34,6 +34,7 @@
#include <tbb/parallel_invoke.h>
#include <algorithm>
#include <atomic>
#include <bitset>
#include <cstdint>
#include <fstream>
@@ -62,18 +63,9 @@ inline EdgeWeight convertToDuration(double speed_in_kmh, double distance_in_mete
if (speed_in_kmh <= 0.)
return MAXIMAL_EDGE_DURATION;
const double speed_in_ms = speed_in_kmh / 3.6;
const double duration = distance_in_meters / speed_in_ms;
return std::max<EdgeWeight>(1, static_cast<EdgeWeight>(std::round(duration * 10.)));
}
inline EdgeWeight convertToWeight(double weight, double weight_multiplier, EdgeWeight duration)
{
if (std::isfinite(weight))
return std::round(weight * weight_multiplier);
return duration == MAXIMAL_EDGE_DURATION ? INVALID_EDGE_WEIGHT
: duration * weight_multiplier / 10.;
const auto speed_in_ms = speed_in_kmh / 3.6;
const auto duration = distance_in_meters / speed_in_ms;
return std::max(1, boost::numeric_cast<EdgeWeight>(std::round(duration * 10.)));
}
#if !defined(NDEBUG)
@@ -140,8 +132,6 @@ updateSegmentData(const UpdaterConfig &config,
const SegmentLookupTable &segment_speed_lookup,
extractor::SegmentDataContainer &segment_data)
{
auto weight_multiplier = profile_properties.GetWeightMultiplier();
std::vector<util::Coordinate> coordinates;
util::PackedVector<OSMNodeID> osm_node_ids;
extractor::files::readNodes(config.node_based_graph_path, coordinates, osm_node_ids);
@@ -154,6 +144,25 @@ updateSegmentData(const UpdaterConfig &config,
counters_type(num_counters, 0));
const constexpr auto LUA_SOURCE = 0;
// closure to convert SpeedSource value to weight and count fallbacks to durations
std::atomic<std::uint32_t> fallbacks_to_duration{0};
auto convertToWeight = [&profile_properties, &fallbacks_to_duration](
const SpeedSource &value, double distance_in_meters) {
double rate = value.rate;
if (!std::isfinite(rate))
{ // use speed value in meters per second as the rate
++fallbacks_to_duration;
rate = value.speed / 3.6;
}
if (rate <= 0.)
return INVALID_EDGE_WEIGHT;
const auto weight_multiplier = profile_properties.GetWeightMultiplier();
const auto weight = distance_in_meters / rate;
return std::max(1, boost::numeric_cast<EdgeWeight>(std::round(weight * weight_multiplier)));
};
// The check here is enabled by the `--edge-weight-updates-over-factor` flag it logs a
// warning if the new duration exceeds a heuristic of what a reasonable duration update is
std::unique_ptr<extractor::SegmentDataContainer> segment_data_backup;
@@ -191,10 +200,9 @@ updateSegmentData(const UpdaterConfig &config,
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
if (auto value = segment_speed_lookup({u, v}))
{
auto new_duration =
convertToDuration(value->speed, segment_lengths[segment_offset]);
auto new_weight =
convertToWeight(value->weight, weight_multiplier, new_duration);
auto segment_length = segment_lengths[segment_offset];
auto new_duration = convertToDuration(value->speed, segment_length);
auto new_weight = convertToWeight(*value, segment_length);
fwd_was_updated = true;
fwd_weights_range[segment_offset] = new_weight;
@@ -225,10 +233,9 @@ updateSegmentData(const UpdaterConfig &config,
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
if (auto value = segment_speed_lookup({v, u}))
{
auto new_duration =
convertToDuration(value->speed, segment_lengths[segment_offset]);
auto new_weight =
convertToWeight(value->weight, weight_multiplier, new_duration);
auto segment_length = segment_lengths[segment_offset];
auto new_duration = convertToDuration(value->speed, segment_length);
auto new_weight = convertToWeight(*value, segment_length);
rev_was_updated = true;
rev_weights_range[segment_offset] = new_weight;
@@ -271,6 +278,13 @@ updateSegmentData(const UpdaterConfig &config,
}
}
if (!profile_properties.fallback_to_duration && fallbacks_to_duration > 0)
{
util::Log(logWARNING) << "Speed values were used to update " << fallbacks_to_duration
<< " segments for '" << profile_properties.GetWeightName()
<< "' profile";
}
if (config.log_edge_updates_factor > 0)
{
BOOST_ASSERT(segment_data_backup);
+1 -1
View File
@@ -11,7 +11,7 @@ OSRM_CUSTOMIZE:=$(OSRM_BUILD_DIR)/osrm-customize
OSRM_ROUTED:=$(OSRM_BUILD_DIR)/osrm-routed
POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js
MD5SUM:=$(SCRIPT_ROOT)/md5sum.js
TIMER:=$(SCRIPT_ROOT)/timer.sh
TIMER:=$(SCRIPT_ROOT)/timer.js
PROFILE:=$(PROFILE_ROOT)/car.lua
all: data
+10 -6
View File
@@ -53,10 +53,10 @@ BOOST_AUTO_TEST_CASE(two_item_trace_needs_tidiying_test)
auto result = tidy::tidy(params, thresholds);
BOOST_CHECK_EQUAL(result.can_be_removed.size(), 2);
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 1);
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
BOOST_CHECK_EQUAL(result.can_be_removed[1], true);
BOOST_CHECK_EQUAL(result.can_be_removed[1], false);
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
}
@@ -87,16 +87,18 @@ BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_test)
auto result = tidy::tidy(params, thresholds);
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 3);
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
BOOST_CHECK_EQUAL(result.tidied_to_original[2], 5);
const auto redundant = result.can_be_removed.count();
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 2);
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 3);
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
BOOST_CHECK_EQUAL(result.can_be_removed[5], false);
}
BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_no_timestamps_test)
@@ -118,15 +120,17 @@ BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_no_timestamps_test)
auto result = tidy::tidy(params, thresholds);
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 3);
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
BOOST_CHECK_EQUAL(result.tidied_to_original[2], 5);
const auto redundant = result.can_be_removed.count();
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 2);
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 3);
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
BOOST_CHECK_EQUAL(result.can_be_removed[5], false);
}
BOOST_AUTO_TEST_SUITE_END()