Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e932ffbc3 | |||
| 810596bb83 | |||
| acabf0075c | |||
| 1ed72db210 | |||
| 6bdf95dfb4 | |||
| 785ae89cd8 | |||
| 16680191de | |||
| 59b70c4d11 | |||
| f96bae40ac | |||
| ba974c73bf | |||
| e498ad3ee7 | |||
| 1de031ed06 | |||
| d6ac924b94 | |||
| ee24473cbb | |||
| c19a3cec1c | |||
| f3694be1a0 | |||
| 306d86ce58 | |||
| 2c001b63a5 | |||
| e162dda836 | |||
| 10c532bd4c | |||
| c8a7bc1d6a | |||
| 9ca3c69b49 | |||
| d1cf8c1fd5 | |||
| 018742f50f | |||
| b82d21f856 | |||
| cfaadf198f | |||
| 6698b5e07e | |||
| 37794a5e8a | |||
| a88fef2937 | |||
| da474a16a9 | |||
| 59bbfeb67f | |||
| 4e9e2ed5bd | |||
| e0593c7ca2 | |||
| 1f69df0d89 | |||
| 05706879a0 | |||
| 7e49b36198 | |||
| 56bcb491d3 | |||
| f4e2bd848d | |||
| 0cf96314a3 |
+119
-14
@@ -7,8 +7,9 @@ git:
|
|||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
nodejs:
|
node_js:
|
||||||
- "4"
|
- "4"
|
||||||
|
- "6"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
@@ -16,6 +17,7 @@ notifications:
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
- "5.7"
|
||||||
# enable building tags
|
# enable building tags
|
||||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||||
|
|
||||||
@@ -36,6 +38,7 @@ env:
|
|||||||
- CCACHE_VERSION=3.3.1
|
- CCACHE_VERSION=3.3.1
|
||||||
- CMAKE_VERSION=3.7.2
|
- CMAKE_VERSION=3.7.2
|
||||||
- MASON="$(pwd)/scripts/mason.sh"
|
- MASON="$(pwd)/scripts/mason.sh"
|
||||||
|
- NODE="4"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
@@ -132,11 +135,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']
|
#- 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
|
#- 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 ENABLE_NODE_BINDINGS=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 ENABLE_NODE_BINDINGS=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 ENABLE_NODE_BINDINGS=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 ENABLE_NODE_BINDINGS=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:
|
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 [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
if [[ -z $JOBS ]]; then
|
||||||
export JOBS=$((`nproc` + 1))
|
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
|
fi
|
||||||
- |
|
- |
|
||||||
if [ -n "${RUN_CLANG_FORMAT}" ]; then
|
if [ -n "${RUN_CLANG_FORMAT}" ]; then
|
||||||
@@ -144,8 +248,10 @@ before_install:
|
|||||||
fi
|
fi
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
export JOBS=$((`sysctl -n hw.ncpu` + 1))
|
|
||||||
sudo mdutil -i off /
|
sudo mdutil -i off /
|
||||||
|
fi
|
||||||
|
- |
|
||||||
|
if [[ ! -f $(which yarn) ]]; then
|
||||||
npm install -g yarn
|
npm install -g yarn
|
||||||
fi
|
fi
|
||||||
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
|
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
|
||||||
@@ -173,15 +279,17 @@ before_install:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
|
- 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:
|
install:
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||||
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||||
fi
|
fi
|
||||||
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
- mkdir ${OSRM_BUILD_DIR} && pushd ${OSRM_BUILD_DIR}
|
|
||||||
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
|
|
||||||
- |
|
- |
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
||||||
@@ -191,7 +299,8 @@ install:
|
|||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||||
-DBUILD_TOOLS=ON \
|
-DBUILD_TOOLS=ON \
|
||||||
-DENABLE_CCACHE=ON
|
-DENABLE_CCACHE=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
||||||
- echo "travis_fold:start:MAKE"
|
- echo "travis_fold:start:MAKE"
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- make tests --jobs=${JOBS}
|
- make tests --jobs=${JOBS}
|
||||||
@@ -201,10 +310,11 @@ install:
|
|||||||
- sudo make install
|
- sudo make install
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||||
sudo ldconfig
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib
|
||||||
fi
|
fi
|
||||||
- popd
|
- popd
|
||||||
- mkdir example/build && pushd example/build
|
- mkdir example/build && pushd example/build
|
||||||
|
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- popd
|
- popd
|
||||||
@@ -235,8 +345,3 @@ after_success:
|
|||||||
if [ -n "${ENABLE_COVERAGE}" ]; then
|
if [ -n "${ENABLE_COVERAGE}" ]; then
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- |
|
|
||||||
if [ -n "${ENABLE_NODE_BINDINGS}" ]; then
|
|
||||||
./scripts/travis/publish.sh
|
|
||||||
fi
|
|
||||||
|
|||||||
+13
-2
@@ -1,17 +1,28 @@
|
|||||||
- Track preprocessing flag in the map matching plugin.
|
|
||||||
|
|
||||||
# 5.7.0
|
# 5.7.0
|
||||||
- Changes from 5.6
|
- Changes from 5.6
|
||||||
|
- 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
|
- 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`.
|
- 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
|
- 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
|
- 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
|
- Files
|
||||||
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
|
- .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.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
|
||||||
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
|
- `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
|
- 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
|
- 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
|
# 5.6.3
|
||||||
- Changes from 5.6.0
|
- Changes from 5.6.0
|
||||||
|
|||||||
@@ -37,27 +37,35 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
The easiest and quickest way to setup your own routing engine backend is to use Docker images we provide.
|
The easiest and quickest way to setup your own routing engine is to use Docker images we provide.
|
||||||
|
|
||||||
### Using Docker
|
### Using Docker
|
||||||
|
|
||||||
We base [our Docker images](https://hub.docker.com/r/osrm/osrm-backend/) on Alpine Linux and make sure they are as lightweight as possible.
|
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
|
||||||
|
|
||||||
```
|
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/)
|
||||||
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
|
|
||||||
|
|
||||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
|
||||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-contract /data/berlin-latest.osrm
|
|
||||||
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
|
|
||||||
|
|
||||||
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
|
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
|
||||||
```
|
|
||||||
|
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||||
|
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-contract /data/berlin-latest.osrm
|
||||||
|
|
||||||
|
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
|
||||||
|
|
||||||
|
Make requests against the HTTP server
|
||||||
|
|
||||||
|
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
|
||||||
|
|
||||||
|
Optionally start a user-friendly frontend on port 9966, and open it up in your browser
|
||||||
|
|
||||||
|
docker run -p 9966:9966 osrm/osrm-frontend
|
||||||
|
xdg-open 'http://127.0.0.1:9966'
|
||||||
|
|
||||||
In case Docker complains about not being able to connect to the Docker daemon make sure you are in the `docker` group.
|
In case Docker complains about not being able to connect to the Docker daemon make sure you are in the `docker` group.
|
||||||
|
|
||||||
```
|
sudo usermod -aG docker $USER
|
||||||
sudo usermod -aG docker $USER
|
|
||||||
```
|
|
||||||
|
|
||||||
After adding yourself to the `docker` group make sure to log out and back in again with your terminal.
|
After adding yourself to the `docker` group make sure to log out and back in again with your terminal.
|
||||||
|
|
||||||
|
|||||||
@@ -681,3 +681,29 @@ Feature: Basic Roundabout
|
|||||||
| u,r | ug,ar,ar | depart,roundabout-exit-3,arrive |
|
| u,r | ug,ar,ar | depart,roundabout-exit-3,arrive |
|
||||||
| u,s | ug,ds,ds | depart,roundabout-exit-4,arrive |
|
| u,s | ug,ds,ds | depart,roundabout-exit-4,arrive |
|
||||||
| u,t | ug,ft,ft | depart,roundabout-exit-5,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
|
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-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}"
|
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,2"
|
||||||
And stderr should contain "Segment: 1,3"
|
And stderr should contain "Segment: 1,3"
|
||||||
And I route I should get
|
And I route I should get
|
||||||
| from | to | route | speed |
|
| from | to | route | speed |
|
||||||
| a | b | ab,ab | 100 km/h |
|
| a | b | ab,ab | 100 km/h |
|
||||||
| a | c | ac,ac | 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"
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ Feature: Basic Map Matching
|
|||||||
|
|
||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,36
|
1,2,36,10
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||||
@@ -240,7 +240,7 @@ Feature: Basic Map Matching
|
|||||||
|
|
||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,36
|
1,2,36,10
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ Feature: Traffic - speeds
|
|||||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,0
|
1,2,0,0
|
||||||
2,1,0
|
2,1,0,0
|
||||||
2,3,27
|
2,3,27,7.5
|
||||||
3,2,27
|
3,2,27,7.5
|
||||||
1,4,27
|
1,4,27,7.5
|
||||||
4,1,27
|
4,1,27,7.5
|
||||||
"""
|
"""
|
||||||
And the query options
|
And the query options
|
||||||
| annotations | datasources |
|
| annotations | datasources |
|
||||||
@@ -56,12 +56,12 @@ Feature: Traffic - speeds
|
|||||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,1,20020.7
|
1,2,1,0.2777777
|
||||||
2,1,1,20020.7
|
2,1,1
|
||||||
2,3,27,741.5
|
2,3,27
|
||||||
3,2,27,741.5
|
3,2,27,7.5
|
||||||
1,4,27,1275.7
|
1,4,27,7.5
|
||||||
4,1,27,1275.7
|
4,1,27,7.5
|
||||||
"""
|
"""
|
||||||
And the query options
|
And the query options
|
||||||
| annotations | datasources |
|
| annotations | datasources |
|
||||||
@@ -89,26 +89,26 @@ Feature: Traffic - speeds
|
|||||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,1,20020.789
|
1,2,1,0.27777777
|
||||||
2,1,1,20020.123
|
2,1,1,0.27777777
|
||||||
2,3,27,741.56789
|
2,3,27,7.5
|
||||||
3,2,27,741.3
|
3,2,27
|
||||||
1,4,1,34445.12
|
1,4,1
|
||||||
4,1,1,34445.3
|
4,1,1
|
||||||
"""
|
"""
|
||||||
And the query options
|
And the query options
|
||||||
| annotations | datasources |
|
| annotations | datasources |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | a:datasources |
|
| from | to | route | speed | weights | a:datasources |
|
||||||
| a | b | ab,ab | 1 km/h | 20020.789,0 | 1:0 |
|
| a | b | ab,ab | 1 km/h | 20020.735,0 | 1:0 |
|
||||||
| a | c | ab,bc,bc | 2 km/h | 20020.789,741.568,0 | 1: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.568,0 | 1:0 |
|
| b | c | bc,bc | 27 km/h | 741.509,0 | 1:0 |
|
||||||
| a | d | ab,eb,de,de | 2 km/h | 20020.789,378.169,400.415,0 | 1:0: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 |
|
| d | c | dc,dc | 36 km/h | 956.805,0 | 0 |
|
||||||
| g | b | ab,ab | 1 km/h | 10010.392,0 | 1:0 |
|
| g | b | ab,ab | 1 km/h | 10010.365,0 | 1:0 |
|
||||||
| a | g | ab,ab | 1 km/h | 10010.397,0 | 1 |
|
| a | g | ab,ab | 1 km/h | 10010.37,0 | 1 |
|
||||||
| g | a | ab,ab | 1 km/h | 10010.064,0 | 1:1 |
|
| g | a | ab,ab | 1 km/h | 10010.37,0 | 1:1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Speeds that isolate a single node (a)
|
Scenario: Speeds that isolate a single node (a)
|
||||||
@@ -121,10 +121,10 @@ Feature: Traffic - speeds
|
|||||||
"""
|
"""
|
||||||
1,2,0
|
1,2,0
|
||||||
2,1,0
|
2,1,0
|
||||||
2,3,27
|
2,3,27,7.5
|
||||||
3,2,27
|
3,2,27,7.5
|
||||||
1,4,0
|
1,4,0,0
|
||||||
4,1,0
|
4,1,0,0
|
||||||
"""
|
"""
|
||||||
And the query options
|
And the query options
|
||||||
| annotations | true |
|
| annotations | true |
|
||||||
|
|||||||
@@ -284,8 +284,8 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,d | , | 59.9m | 62,0 | 24s,0s |
|
| a,d | , | 59.9m | 20.5,0 | 24s,0s |
|
||||||
| a,e | ,, | 60.1m | 68.7,10,0 | 38.5s,11s,0s |
|
| a,e | ,, | 60.1m | 27.2,10,0 | 38.5s,11s,0s |
|
||||||
| d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s |
|
| d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s |
|
||||||
|
|
||||||
@traffic @speed
|
@traffic @speed
|
||||||
@@ -320,6 +320,6 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,d | abcd,abcd | 59.9m | 6.993,0 | 7s,0s |
|
| a,d | abcd,abcd | 59.9m | 6.996,0 | 7s,0s |
|
||||||
| a,e | abcd,ce,ce | 60.1m | 6.002,2.002,0 | 6s,2s,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 |
|
| d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s |
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SearchEngineData<Algorithm> &heaps;
|
SearchEngineData<Algorithm> &heaps;
|
||||||
|
|
||||||
// Owned by shared-ptr passed to the query
|
// Owned by shared-ptr passed to the query
|
||||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
|
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ namespace routing_algorithms
|
|||||||
/// by the previous route.
|
/// by the previous route.
|
||||||
/// This variation is only an optimazation for graphs with slow queries, for example
|
/// This variation is only an optimazation for graphs with slow queries, for example
|
||||||
/// not fully contracted graphs.
|
/// not fully contracted graphs.
|
||||||
template <typename Algorithm>
|
InternalRouteResult directShortestPathSearch(
|
||||||
InternalRouteResult
|
SearchEngineData<ch::Algorithm> &engine_working_data,
|
||||||
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
||||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
const PhantomNodes &phantom_nodes);
|
||||||
const PhantomNodes &phantom_nodes);
|
|
||||||
|
InternalRouteResult directShortestPathSearch(
|
||||||
|
SearchEngineData<corech::Algorithm> &engine_working_data,
|
||||||
|
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||||
|
const PhantomNodes &phantom_nodes);
|
||||||
|
|
||||||
InternalRouteResult directShortestPathSearch(
|
InternalRouteResult directShortestPathSearch(
|
||||||
SearchEngineData<mld::Algorithm> &engine_working_data,
|
SearchEngineData<mld::Algorithm> &engine_working_data,
|
||||||
|
|||||||
@@ -350,63 +350,29 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
|
|||||||
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
||||||
// requires
|
// requires
|
||||||
// a force loop, if the heaps have been initialized with positive offsets.
|
// 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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
std::int32_t &weight,
|
std::int32_t &weight,
|
||||||
std::vector<NodeID> &packed_leg,
|
std::vector<NodeID> &packed_leg,
|
||||||
const bool force_loop_forward,
|
const bool force_loop_forward,
|
||||||
const bool force_loop_reverse,
|
const bool force_loop_reverse,
|
||||||
|
const PhantomNodes &phantom_nodes,
|
||||||
const int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
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
|
// Requires the heaps for be empty
|
||||||
// If heaps should be adjusted to be initialized outside of this function,
|
// If heaps should be adjusted to be initialized outside of this function,
|
||||||
// the addition of force_loop parameters might be required
|
// the addition of force_loop parameters might be required
|
||||||
double
|
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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
const PhantomNode &source_phantom,
|
const PhantomNode &source_phantom,
|
||||||
const PhantomNode &target_phantom,
|
const PhantomNode &target_phantom,
|
||||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
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 ch
|
||||||
|
|
||||||
namespace corech
|
namespace corech
|
||||||
@@ -420,11 +386,10 @@ namespace corech
|
|||||||
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
||||||
// requires
|
// requires
|
||||||
// a force loop, if the heaps have been initialized with positive offsets.
|
// a force loop, if the heaps have been initialized with positive offsets.
|
||||||
void search(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
|
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
|
|
||||||
int &weight,
|
int &weight,
|
||||||
std::vector<NodeID> &packed_leg,
|
std::vector<NodeID> &packed_leg,
|
||||||
const bool force_loop_forward,
|
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,
|
// If heaps should be adjusted to be initialized outside of this function,
|
||||||
// the addition of force_loop parameters might be required
|
// the addition of force_loop parameters might be required
|
||||||
double
|
double
|
||||||
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
|
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
|
|
||||||
const PhantomNode &source_phantom,
|
const PhantomNode &source_phantom,
|
||||||
const PhantomNode &target_phantom,
|
const PhantomNode &target_phantom,
|
||||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||||
|
|||||||
@@ -181,11 +181,13 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
|
|||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
std::tuple<EdgeWeight, NodeID, NodeID, std::vector<EdgeID>>
|
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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
const bool force_loop_forward,
|
const bool force_loop_forward,
|
||||||
const bool force_loop_reverse,
|
const bool force_loop_reverse,
|
||||||
|
EdgeWeight weight_upper_bound,
|
||||||
Args... args)
|
Args... args)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -196,7 +198,7 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
|||||||
|
|
||||||
// run two-Target Dijkstra routing step.
|
// run two-Target Dijkstra routing step.
|
||||||
NodeID middle = SPECIAL_NODEID;
|
NodeID middle = SPECIAL_NODEID;
|
||||||
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
EdgeWeight weight = weight_upper_bound;
|
||||||
EdgeWeight forward_heap_min = forward_heap.MinKey();
|
EdgeWeight forward_heap_min = forward_heap.MinKey();
|
||||||
EdgeWeight reverse_heap_min = reverse_heap.MinKey();
|
EdgeWeight reverse_heap_min = reverse_heap.MinKey();
|
||||||
while (forward_heap.Size() + reverse_heap.Size() > 0 &&
|
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?
|
// 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(
|
return std::make_tuple(
|
||||||
INVALID_EDGE_WEIGHT, SPECIAL_NODEID, SPECIAL_NODEID, std::vector<EdgeID>());
|
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;
|
NodeID subpath_source, subpath_target;
|
||||||
std::vector<EdgeID> subpath;
|
std::vector<EdgeID> subpath;
|
||||||
std::tie(subpath_weight, subpath_source, subpath_target, subpath) =
|
std::tie(subpath_weight, subpath_source, subpath_target, subpath) =
|
||||||
search(facade,
|
search(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
force_loop_forward,
|
force_loop_forward,
|
||||||
force_loop_reverse,
|
force_loop_reverse,
|
||||||
|
INVALID_EDGE_WEIGHT,
|
||||||
sublevel,
|
sublevel,
|
||||||
parent_cell_id);
|
parent_cell_id);
|
||||||
BOOST_ASSERT(!subpath.empty());
|
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));
|
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
|
// 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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &,
|
|
||||||
SearchEngineData<Algorithm>::QueryHeap &,
|
|
||||||
EdgeWeight &weight,
|
EdgeWeight &weight,
|
||||||
std::vector<NodeID> &packed_leg,
|
std::vector<NodeID> &packed_leg,
|
||||||
const bool force_loop_forward,
|
const bool force_loop_forward,
|
||||||
const bool force_loop_reverse,
|
const bool force_loop_reverse,
|
||||||
const PhantomNodes &phantom_nodes,
|
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;
|
NodeID source_node, target_node;
|
||||||
std::vector<EdgeID> unpacked_edges;
|
std::vector<EdgeID> unpacked_edges;
|
||||||
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(
|
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, phantom_nodes);
|
facade,
|
||||||
|
forward_heap,
|
||||||
|
reverse_heap,
|
||||||
|
force_loop_forward,
|
||||||
|
force_loop_reverse,
|
||||||
|
weight_upper_bound,
|
||||||
|
phantom_nodes);
|
||||||
|
|
||||||
if (weight != INVALID_EDGE_WEIGHT)
|
if (weight != INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
@@ -367,14 +375,13 @@ void unpackPath(const FacadeT &facade,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline double
|
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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap & /*forward_core_heap*/,
|
|
||||||
SearchEngineData<Algorithm>::QueryHeap & /*reverse_core_heap*/,
|
|
||||||
const PhantomNode &source_phantom,
|
const PhantomNode &source_phantom,
|
||||||
const PhantomNode &target_phantom,
|
const PhantomNode &target_phantom,
|
||||||
int /*duration_upper_bound*/)
|
EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
forward_heap.Clear();
|
forward_heap.Clear();
|
||||||
reverse_heap.Clear();
|
reverse_heap.Clear();
|
||||||
@@ -385,8 +392,14 @@ getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorith
|
|||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
NodeID source_node, target_node;
|
NodeID source_node, target_node;
|
||||||
std::vector<EdgeID> unpacked_edges;
|
std::vector<EdgeID> unpacked_edges;
|
||||||
std::tie(weight, source_node, target_node, unpacked_edges) = search(
|
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, phantom_nodes);
|
facade,
|
||||||
|
forward_heap,
|
||||||
|
reverse_heap,
|
||||||
|
DO_NOT_FORCE_LOOPS,
|
||||||
|
DO_NOT_FORCE_LOOPS,
|
||||||
|
weight_upper_bound,
|
||||||
|
phantom_nodes);
|
||||||
|
|
||||||
if (weight == INVALID_EDGE_WEIGHT)
|
if (weight == INVALID_EDGE_WEIGHT)
|
||||||
return std::numeric_limits<double>::max();
|
return std::numeric_limits<double>::max();
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ namespace osrm
|
|||||||
namespace engine
|
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
|
struct HeapData
|
||||||
{
|
{
|
||||||
NodeID parent;
|
NodeID parent;
|
||||||
@@ -24,7 +34,7 @@ struct ManyToManyHeapData : HeapData
|
|||||||
ManyToManyHeapData(NodeID p, EdgeWeight duration) : HeapData(p), duration(duration) {}
|
ManyToManyHeapData(NodeID p, EdgeWeight duration) : HeapData(p), duration(duration) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Algorithm> struct SearchEngineData
|
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||||
{
|
{
|
||||||
using QueryHeap = util::
|
using QueryHeap = util::
|
||||||
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
|
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
|
||||||
@@ -55,6 +65,12 @@ template <typename Algorithm> struct SearchEngineData
|
|||||||
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
|
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct SearchEngineData<routing_algorithms::corech::Algorithm>
|
||||||
|
: public SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct MultiLayerDijkstraHeapData
|
struct MultiLayerDijkstraHeapData
|
||||||
{
|
{
|
||||||
NodeID parent;
|
NodeID parent;
|
||||||
@@ -75,12 +91,8 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
|||||||
|
|
||||||
static SearchEngineHeapPtr forward_heap_1;
|
static SearchEngineHeapPtr forward_heap_1;
|
||||||
static SearchEngineHeapPtr reverse_heap_1;
|
static SearchEngineHeapPtr reverse_heap_1;
|
||||||
static SearchEngineHeapPtr forward_heap_2;
|
|
||||||
static SearchEngineHeapPtr reverse_heap_2;
|
|
||||||
|
|
||||||
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes);
|
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);
|
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 restricted_turns_counter;
|
||||||
std::size_t skipped_uturns_counter;
|
std::size_t skipped_uturns_counter;
|
||||||
std::size_t skipped_barrier_turns_counter;
|
std::size_t skipped_barrier_turns_counter;
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ template <typename TurnDataT>
|
|||||||
inline void readTurnData(const boost::filesystem::path &path, TurnDataT &turn_data)
|
inline void readTurnData(const boost::filesystem::path &path, TurnDataT &turn_data)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
|
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;
|
const auto fingerprint = storage::io::FileReader::HasNoFingerprint;
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
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)
|
inline void writeTurnData(const boost::filesystem::path &path, const TurnDataT &turn_data)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
|
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;
|
const auto fingerprint = storage::io::FileWriter::HasNoFingerprint;
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
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 TurnDataContainer = detail::TurnDataContainerImpl<storage::Ownership::Container>;
|
||||||
using TurnDataView = detail::TurnDataContainerImpl<storage::Ownership::View>;
|
using TurnDataView = detail::TurnDataContainerImpl<storage::Ownership::View>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,39 @@
|
|||||||
#ifndef OSRM_STORAGE_SERIALIZATION_HPP
|
#ifndef OSRM_STORAGE_SERIALIZATION_HPP
|
||||||
#define OSRM_STORAGE_SERIALIZATION_HPP
|
#define OSRM_STORAGE_SERIALIZATION_HPP
|
||||||
|
|
||||||
|
#include "util/integer_range.hpp"
|
||||||
#include "util/vector_view.hpp"
|
#include "util/vector_view.hpp"
|
||||||
|
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace storage
|
namespace storage
|
||||||
{
|
{
|
||||||
namespace serialization
|
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)
|
template <typename T> void read(io::FileReader &reader, std::vector<T> &data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ namespace storage
|
|||||||
enum class Ownership
|
enum class Ownership
|
||||||
{
|
{
|
||||||
Container,
|
Container,
|
||||||
View
|
View,
|
||||||
|
External
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ struct Segment final
|
|||||||
|
|
||||||
struct SpeedSource 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;
|
unsigned speed;
|
||||||
double weight;
|
double rate;
|
||||||
std::uint8_t source;
|
std::uint8_t source;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "storage/shared_memory_ownership.hpp"
|
#include "storage/shared_memory_ownership.hpp"
|
||||||
|
|
||||||
|
#include <stxxl/vector>
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/iterator/reverse_iterator.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);
|
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>
|
template <typename DataT, storage::Ownership Ownership>
|
||||||
using ViewOrVector = typename std::conditional<Ownership == storage::Ownership::View,
|
using ViewOrVector = typename std::conditional<Ownership == storage::Ownership::View,
|
||||||
vector_view<DataT>,
|
vector_view<DataT>,
|
||||||
std::vector<DataT>>::type;
|
InternalOrExternalVector<DataT, Ownership>>::type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "osrm",
|
"name": "osrm",
|
||||||
"version": "5.7.0-latest.5",
|
"version": "5.7.0-rc.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||||
"dependencies": {
|
"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",
|
"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",
|
"clean": "rm -rf test/cache",
|
||||||
"docs": "./scripts/build_api_docs.sh",
|
"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"
|
"nodejs-tests": "make -C test/data && ./lib/binding/osrm-datastore test/data/ch/monaco.osrm && node test/nodejs/index.js | faucet"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
],
|
],
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"binary": {
|
"binary": {
|
||||||
"module_name": "node-osrm",
|
"module_name": "node_osrm",
|
||||||
"module_path": "./lib/binding/",
|
"module_path": "./lib/binding/",
|
||||||
"host": "https://mapbox-node-binary.s3.amazonaws.com",
|
"host": "https://mapbox-node-binary.s3.amazonaws.com",
|
||||||
"remote_path": "./{name}/v{version}/{configuration}/",
|
"remote_path": "./{name}/v{version}/{configuration}/",
|
||||||
|
|||||||
Executable
+20
@@ -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
|
||||||
Executable
+16
@@ -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');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
@@ -3,15 +3,19 @@
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
echo "node version is:"
|
||||||
|
which node
|
||||||
|
node -v
|
||||||
|
|
||||||
if [[ ${PUBLISH} == 'On' ]]; then
|
if [[ ${PUBLISH} == 'On' ]]; then
|
||||||
echo "PUBLISH is set to '${PUBLISH}', publishing!"
|
echo "PUBLISH is set to '${PUBLISH}', publishing!"
|
||||||
|
NPM_FLAGS=''
|
||||||
echo "node version is:"
|
if [[ ${BUILD_TYPE} == "Debug" ]]; then
|
||||||
which node
|
NPM_FLAGS='--debug'
|
||||||
node -v
|
fi
|
||||||
|
|
||||||
echo "dumping binary meta..."
|
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
|
# enforce that binary has proper ORIGIN flags so that
|
||||||
# it can portably find libtbb.so in the same directory
|
# it can portably find libtbb.so in the same directory
|
||||||
@@ -27,7 +31,7 @@ if [[ ${PUBLISH} == 'On' ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./node_modules/.bin/node-pre-gyp package publish info
|
./node_modules/.bin/node-pre-gyp package publish info $NPM_FLAGS
|
||||||
else
|
else
|
||||||
echo "PUBLISH is set to '${PUBLISH}', skipping."
|
echo "PUBLISH is set to '${PUBLISH}', skipping."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -118,12 +118,14 @@ bool setUpRoundabout(RouteStep &step)
|
|||||||
|
|
||||||
void closeOffRoundabout(const bool on_roundabout,
|
void closeOffRoundabout(const bool on_roundabout,
|
||||||
std::vector<RouteStep> &steps,
|
std::vector<RouteStep> &steps,
|
||||||
const std::size_t step_index)
|
std::size_t step_index)
|
||||||
{
|
{
|
||||||
auto &step = steps[step_index];
|
auto &step = steps[step_index];
|
||||||
step.maneuver.exit += 1;
|
step.maneuver.exit += 1;
|
||||||
if (!on_roundabout)
|
if (!on_roundabout)
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(steps.size() >= 2);
|
||||||
|
|
||||||
// We reached a special case that requires the addition of a special route step in the
|
// 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
|
// 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
|
// 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
|
// 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
|
// index back to the entering location and prepare the current silent set of instructions for
|
||||||
// removal.
|
// removal.
|
||||||
@@ -170,6 +189,7 @@ void closeOffRoundabout(const bool on_roundabout,
|
|||||||
const auto exit_intersection = steps[step_index].intersections.front();
|
const auto exit_intersection = steps[step_index].intersections.front();
|
||||||
const auto exit_bearing = exit_intersection.bearings[exit_intersection.out];
|
const auto exit_bearing = exit_intersection.bearings[exit_intersection.out];
|
||||||
const auto destination_copy = step;
|
const auto destination_copy = step;
|
||||||
|
|
||||||
if (step_index > 1)
|
if (step_index > 1)
|
||||||
{
|
{
|
||||||
// The very first route-step is head, so we cannot iterate past that one
|
// 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)
|
--propagation_index)
|
||||||
{
|
{
|
||||||
auto &propagation_step = steps[propagation_index];
|
auto &propagation_step = steps[propagation_index];
|
||||||
propagation_step.ElongateBy(steps[propagation_index + 1]);
|
auto &next_step = steps[propagation_index + 1];
|
||||||
propagation_step.maneuver.exit = steps[propagation_index + 1].maneuver.exit;
|
propagation_step.ElongateBy(next_step);
|
||||||
|
propagation_step.maneuver.exit = next_step.maneuver.exit;
|
||||||
|
next_step.Invalidate();
|
||||||
|
|
||||||
if (entersRoundabout(propagation_step.maneuver.instruction))
|
if (entersRoundabout(propagation_step.maneuver.instruction))
|
||||||
{
|
{
|
||||||
const auto entry_intersection = propagation_step.intersections.front();
|
const auto entry_intersection = propagation_step.intersections.front();
|
||||||
@@ -206,13 +229,8 @@ void closeOffRoundabout(const bool on_roundabout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
propagation_step.AdaptStepSignage(destination_copy);
|
propagation_step.AdaptStepSignage(destination_copy);
|
||||||
steps[propagation_index + 1].Invalidate();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
steps[propagation_index + 1].Invalidate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// remove exit
|
// remove exit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,25 +62,19 @@ InternalRouteResult directShortestPathSearchImpl(
|
|||||||
const PhantomNodes &phantom_nodes)
|
const PhantomNodes &phantom_nodes)
|
||||||
{
|
{
|
||||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
|
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
|
||||||
engine_working_data.InitializeOrClearSecondThreadLocalStorage(facade.GetNumberOfNodes());
|
|
||||||
auto &forward_heap = *engine_working_data.forward_heap_1;
|
auto &forward_heap = *engine_working_data.forward_heap_1;
|
||||||
auto &reverse_heap = *engine_working_data.reverse_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();
|
forward_heap.Clear();
|
||||||
reverse_heap.Clear();
|
reverse_heap.Clear();
|
||||||
forward_core_heap.Clear();
|
|
||||||
reverse_core_heap.Clear();
|
|
||||||
|
|
||||||
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
||||||
std::vector<NodeID> packed_leg;
|
std::vector<NodeID> packed_leg;
|
||||||
insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes);
|
insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes);
|
||||||
|
|
||||||
search(facade,
|
search(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
weight,
|
weight,
|
||||||
packed_leg,
|
packed_leg,
|
||||||
DO_NOT_FORCE_LOOPS,
|
DO_NOT_FORCE_LOOPS,
|
||||||
@@ -107,7 +101,6 @@ InternalRouteResult directShortestPathSearchImpl(
|
|||||||
|
|
||||||
} // namespace ch
|
} // namespace ch
|
||||||
|
|
||||||
template <>
|
|
||||||
InternalRouteResult directShortestPathSearch(
|
InternalRouteResult directShortestPathSearch(
|
||||||
SearchEngineData<corech::Algorithm> &engine_working_data,
|
SearchEngineData<corech::Algorithm> &engine_working_data,
|
||||||
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||||
@@ -116,7 +109,6 @@ InternalRouteResult directShortestPathSearch(
|
|||||||
return detail::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes);
|
return detail::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
|
||||||
InternalRouteResult directShortestPathSearch(
|
InternalRouteResult directShortestPathSearch(
|
||||||
SearchEngineData<ch::Algorithm> &engine_working_data,
|
SearchEngineData<ch::Algorithm> &engine_working_data,
|
||||||
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
||||||
@@ -140,8 +132,14 @@ InternalRouteResult directShortestPathSearch(
|
|||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
NodeID source_node, target_node;
|
NodeID source_node, target_node;
|
||||||
std::vector<EdgeID> unpacked_edges;
|
std::vector<EdgeID> unpacked_edges;
|
||||||
std::tie(weight, source_node, target_node, unpacked_edges) = mld::search(
|
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, phantom_nodes);
|
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);
|
return extractRoute(facade, weight, source_node, target_node, unpacked_edges, phantom_nodes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,9 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
|
|
||||||
const auto nodes_number = facade.GetNumberOfNodes();
|
const auto nodes_number = facade.GetNumberOfNodes();
|
||||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number);
|
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number);
|
||||||
engine_working_data.InitializeOrClearSecondThreadLocalStorage(nodes_number);
|
|
||||||
|
|
||||||
auto &forward_heap = *engine_working_data.forward_heap_1;
|
auto &forward_heap = *engine_working_data.forward_heap_1;
|
||||||
auto &reverse_heap = *engine_working_data.reverse_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::size_t breakage_begin = map_matching::INVALID_STATE;
|
||||||
std::vector<std::size_t> split_points;
|
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(
|
const auto haversine_distance = util::coordinate_calculation::haversineDistance(
|
||||||
prev_coordinate, current_coordinate);
|
prev_coordinate, current_coordinate);
|
||||||
// assumes minumum of 0.1 m/s
|
// assumes minumum of 4 m/s
|
||||||
const int duration_upper_bound =
|
const EdgeWeight weight_upper_bound =
|
||||||
((haversine_distance + max_distance_delta) * 0.25) * 10;
|
((haversine_distance + max_distance_delta) / 4.) * facade.GetWeightMultiplier();
|
||||||
|
|
||||||
// compute d_t for this timestamp and the next one
|
// compute d_t for this timestamp and the next one
|
||||||
for (const auto s : util::irange<std::size_t>(0UL, prev_viterbi.size()))
|
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 =
|
double network_distance =
|
||||||
getNetworkDistance(facade,
|
getNetworkDistance(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
prev_unbroken_timestamps_list[s].phantom_node,
|
prev_unbroken_timestamps_list[s].phantom_node,
|
||||||
current_timestamps_list[s_prime].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
|
// get distance diff between loc1/2 and locs/s_prime
|
||||||
const auto d_t = std::abs(network_distance - haversine_distance);
|
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())
|
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
||||||
// requires
|
// requires
|
||||||
// a force loop, if the heaps have been initialized with positive offsets.
|
// 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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
EdgeWeight &weight,
|
EdgeWeight &weight,
|
||||||
std::vector<NodeID> &packed_leg,
|
std::vector<NodeID> &packed_leg,
|
||||||
const bool force_loop_forward,
|
const bool force_loop_forward,
|
||||||
const bool force_loop_reverse,
|
const bool force_loop_reverse,
|
||||||
|
const PhantomNodes & /*phantom_nodes*/,
|
||||||
const EdgeWeight weight_upper_bound)
|
const EdgeWeight weight_upper_bound)
|
||||||
{
|
{
|
||||||
NodeID middle = SPECIAL_NODEID;
|
NodeID middle = SPECIAL_NODEID;
|
||||||
@@ -142,7 +144,8 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
|
|||||||
// Requires the heaps for be empty
|
// Requires the heaps for be empty
|
||||||
// If heaps should be adjusted to be initialized outside of this function,
|
// If heaps should be adjusted to be initialized outside of this function,
|
||||||
// the addition of force_loop parameters might be required
|
// 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 &forward_heap,
|
||||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
const PhantomNode &source_phantom,
|
const PhantomNode &source_phantom,
|
||||||
@@ -180,13 +183,15 @@ double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<A
|
|||||||
|
|
||||||
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
||||||
std::vector<NodeID> packed_path;
|
std::vector<NodeID> packed_path;
|
||||||
search(facade,
|
search(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
weight,
|
weight,
|
||||||
packed_path,
|
packed_path,
|
||||||
DO_NOT_FORCE_LOOPS,
|
DO_NOT_FORCE_LOOPS,
|
||||||
DO_NOT_FORCE_LOOPS,
|
DO_NOT_FORCE_LOOPS,
|
||||||
|
{source_phantom, target_phantom},
|
||||||
weight_upper_bound);
|
weight_upper_bound);
|
||||||
|
|
||||||
if (weight == INVALID_EDGE_WEIGHT)
|
if (weight == INVALID_EDGE_WEIGHT)
|
||||||
@@ -216,11 +221,10 @@ namespace corech
|
|||||||
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
||||||
// requires
|
// requires
|
||||||
// a force loop, if the heaps have been initialized with positive offsets.
|
// 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,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_core_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_core_heap,
|
|
||||||
EdgeWeight &weight,
|
EdgeWeight &weight,
|
||||||
std::vector<NodeID> &packed_leg,
|
std::vector<NodeID> &packed_leg,
|
||||||
const bool force_loop_forward,
|
const bool force_loop_forward,
|
||||||
@@ -285,8 +289,7 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto insertInCoreHeap = [](const CoreEntryPoint &p,
|
const auto insertInCoreHeap = [](const CoreEntryPoint &p, auto &core_heap) {
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &core_heap) {
|
|
||||||
NodeID id;
|
NodeID id;
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
NodeID parent;
|
NodeID parent;
|
||||||
@@ -295,13 +298,16 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
|
|||||||
core_heap.Insert(id, weight, parent);
|
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)
|
for (const auto &p : forward_entry_points)
|
||||||
{
|
{
|
||||||
insertInCoreHeap(p, forward_core_heap);
|
insertInCoreHeap(p, forward_core_heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse_core_heap.Clear();
|
|
||||||
for (const auto &p : reverse_entry_points)
|
for (const auto &p : reverse_entry_points)
|
||||||
{
|
{
|
||||||
insertInCoreHeap(p, reverse_core_heap);
|
insertInCoreHeap(p, reverse_core_heap);
|
||||||
@@ -395,29 +401,25 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
|
|||||||
// Requires the heaps for be empty
|
// Requires the heaps for be empty
|
||||||
// If heaps should be adjusted to be initialized outside of this function,
|
// If heaps should be adjusted to be initialized outside of this function,
|
||||||
// the addition of force_loop parameters might be required
|
// the addition of force_loop parameters might be required
|
||||||
double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_core_heap,
|
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_core_heap,
|
|
||||||
const PhantomNode &source_phantom,
|
const PhantomNode &source_phantom,
|
||||||
const PhantomNode &target_phantom,
|
const PhantomNode &target_phantom,
|
||||||
EdgeWeight weight_upper_bound)
|
EdgeWeight weight_upper_bound)
|
||||||
{
|
{
|
||||||
forward_heap.Clear();
|
forward_heap.Clear();
|
||||||
reverse_heap.Clear();
|
reverse_heap.Clear();
|
||||||
forward_core_heap.Clear();
|
|
||||||
reverse_core_heap.Clear();
|
|
||||||
|
|
||||||
insertNodesInHeaps(forward_heap, reverse_heap, {source_phantom, target_phantom});
|
insertNodesInHeaps(forward_heap, reverse_heap, {source_phantom, target_phantom});
|
||||||
|
|
||||||
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
EdgeWeight weight = INVALID_EDGE_WEIGHT;
|
||||||
std::vector<NodeID> packed_path;
|
std::vector<NodeID> packed_path;
|
||||||
search(facade,
|
search(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
weight,
|
weight,
|
||||||
packed_path,
|
packed_path,
|
||||||
DO_NOT_FORCE_LOOPS,
|
DO_NOT_FORCE_LOOPS,
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ const static constexpr bool DO_NOT_FORCE_LOOP = false;
|
|||||||
// allows a uturn at the target_phantom
|
// allows a uturn at the target_phantom
|
||||||
// searches source forward/reverse -> target forward/reverse
|
// searches source forward/reverse -> target forward/reverse
|
||||||
template <typename Algorithm>
|
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 &forward_heap,
|
||||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_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_forward_node,
|
||||||
const bool search_from_reverse_node,
|
const bool search_from_reverse_node,
|
||||||
const bool search_to_forward_node,
|
const bool search_to_forward_node,
|
||||||
@@ -75,15 +74,10 @@ void searchWithUTurn(const datafacade::ContiguousInternalMemoryDataFacade<Algori
|
|||||||
auto needs_loop_backwards =
|
auto needs_loop_backwards =
|
||||||
is_oneway_target && needsLoopBackwards(source_phantom, target_phantom);
|
is_oneway_target && needsLoopBackwards(source_phantom, target_phantom);
|
||||||
|
|
||||||
forward_core_heap.Clear();
|
search(engine_working_data,
|
||||||
reverse_core_heap.Clear();
|
facade,
|
||||||
BOOST_ASSERT(forward_core_heap.Size() == 0);
|
|
||||||
BOOST_ASSERT(reverse_core_heap.Size() == 0);
|
|
||||||
search(facade,
|
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
new_total_weight,
|
new_total_weight,
|
||||||
leg_packed_path,
|
leg_packed_path,
|
||||||
needs_loop_forwards,
|
needs_loop_forwards,
|
||||||
@@ -101,11 +95,10 @@ void searchWithUTurn(const datafacade::ContiguousInternalMemoryDataFacade<Algori
|
|||||||
// source forward/reverse -> target forward
|
// source forward/reverse -> target forward
|
||||||
// source forward/reverse -> target reverse
|
// source forward/reverse -> target reverse
|
||||||
template <typename Algorithm>
|
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 &forward_heap,
|
||||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_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_forward_node,
|
||||||
const bool search_from_reverse_node,
|
const bool search_from_reverse_node,
|
||||||
const bool search_to_forward_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(forward_heap.Size() > 0);
|
||||||
BOOST_ASSERT(reverse_heap.Size() > 0);
|
BOOST_ASSERT(reverse_heap.Size() > 0);
|
||||||
|
|
||||||
forward_core_heap.Clear();
|
search(engine_working_data,
|
||||||
reverse_core_heap.Clear();
|
facade,
|
||||||
BOOST_ASSERT(forward_core_heap.Size() == 0);
|
|
||||||
BOOST_ASSERT(reverse_core_heap.Size() == 0);
|
|
||||||
search(facade,
|
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
new_total_weight_to_forward,
|
new_total_weight_to_forward,
|
||||||
leg_packed_path_forward,
|
leg_packed_path_forward,
|
||||||
needsLoopForward(source_phantom, target_phantom),
|
needsLoopForward(source_phantom, target_phantom),
|
||||||
@@ -183,15 +171,10 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &fac
|
|||||||
}
|
}
|
||||||
BOOST_ASSERT(forward_heap.Size() > 0);
|
BOOST_ASSERT(forward_heap.Size() > 0);
|
||||||
BOOST_ASSERT(reverse_heap.Size() > 0);
|
BOOST_ASSERT(reverse_heap.Size() > 0);
|
||||||
forward_core_heap.Clear();
|
search(engine_working_data,
|
||||||
reverse_core_heap.Clear();
|
facade,
|
||||||
BOOST_ASSERT(forward_core_heap.Size() == 0);
|
|
||||||
BOOST_ASSERT(reverse_core_heap.Size() == 0);
|
|
||||||
search(facade,
|
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
new_total_weight_to_reverse,
|
new_total_weight_to_reverse,
|
||||||
leg_packed_path_reverse,
|
leg_packed_path_reverse,
|
||||||
routing_algorithms::DO_NOT_FORCE_LOOP,
|
routing_algorithms::DO_NOT_FORCE_LOOP,
|
||||||
@@ -246,12 +229,9 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
: facade.GetContinueStraightDefault());
|
: facade.GetContinueStraightDefault());
|
||||||
|
|
||||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
|
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
|
||||||
engine_working_data.InitializeOrClearSecondThreadLocalStorage(facade.GetNumberOfNodes());
|
|
||||||
|
|
||||||
auto &forward_heap = *engine_working_data.forward_heap_1;
|
auto &forward_heap = *engine_working_data.forward_heap_1;
|
||||||
auto &reverse_heap = *engine_working_data.reverse_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_forward = 0;
|
||||||
int total_weight_to_reverse = 0;
|
int total_weight_to_reverse = 0;
|
||||||
@@ -294,11 +274,10 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
{
|
{
|
||||||
if (allow_uturn_at_waypoint)
|
if (allow_uturn_at_waypoint)
|
||||||
{
|
{
|
||||||
searchWithUTurn(facade,
|
searchWithUTurn(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
search_from_forward_node,
|
search_from_forward_node,
|
||||||
search_from_reverse_node,
|
search_from_reverse_node,
|
||||||
search_to_forward_node,
|
search_to_forward_node,
|
||||||
@@ -331,11 +310,10 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
search(facade,
|
search(engine_working_data,
|
||||||
|
facade,
|
||||||
forward_heap,
|
forward_heap,
|
||||||
reverse_heap,
|
reverse_heap,
|
||||||
forward_core_heap,
|
|
||||||
reverse_core_heap,
|
|
||||||
search_from_forward_node,
|
search_from_forward_node,
|
||||||
search_from_reverse_node,
|
search_from_reverse_node,
|
||||||
search_to_forward_node,
|
search_to_forward_node,
|
||||||
|
|||||||
@@ -7,30 +7,17 @@ namespace osrm
|
|||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename Algorithm>
|
// CH heaps
|
||||||
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
|
using CH = routing_algorithms::ch::Algorithm;
|
||||||
SearchEngineData<Algorithm>::forward_heap_1;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
|
||||||
template <typename Algorithm>
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
|
||||||
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
|
||||||
SearchEngineData<Algorithm>::reverse_heap_1;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
|
||||||
template <typename Algorithm>
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
|
||||||
typename SearchEngineData<Algorithm>::SearchEngineHeapPtr
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
|
||||||
SearchEngineData<Algorithm>::forward_heap_2;
|
SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
|
||||||
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;
|
|
||||||
|
|
||||||
template <typename Algorithm>
|
void SearchEngineData<CH>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes)
|
||||||
void SearchEngineData<Algorithm>::InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes)
|
|
||||||
{
|
{
|
||||||
if (forward_heap_1.get())
|
if (forward_heap_1.get())
|
||||||
{
|
{
|
||||||
@@ -51,9 +38,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearFirstThreadLocalStorage(unsig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
void SearchEngineData<CH>::InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes)
|
||||||
void SearchEngineData<Algorithm>::InitializeOrClearSecondThreadLocalStorage(
|
|
||||||
unsigned number_of_nodes)
|
|
||||||
{
|
{
|
||||||
if (forward_heap_2.get())
|
if (forward_heap_2.get())
|
||||||
{
|
{
|
||||||
@@ -74,8 +59,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearSecondThreadLocalStorage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
void SearchEngineData<CH>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes)
|
||||||
void SearchEngineData<Algorithm>::InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes)
|
|
||||||
{
|
{
|
||||||
if (forward_heap_3.get())
|
if (forward_heap_3.get())
|
||||||
{
|
{
|
||||||
@@ -96,9 +80,7 @@ void SearchEngineData<Algorithm>::InitializeOrClearThirdThreadLocalStorage(unsig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
void SearchEngineData<CH>::InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes)
|
||||||
void SearchEngineData<Algorithm>::InitializeOrClearManyToManyThreadLocalStorage(
|
|
||||||
unsigned number_of_nodes)
|
|
||||||
{
|
{
|
||||||
if (many_to_many_heap.get())
|
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
|
// MLD
|
||||||
using MLD = routing_algorithms::mld::Algorithm;
|
using MLD = routing_algorithms::mld::Algorithm;
|
||||||
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
||||||
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_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)
|
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));
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,8 +309,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
storage::io::FileWriter turn_penalties_index_file(turn_penalties_index_filename,
|
storage::io::FileWriter turn_penalties_index_file(turn_penalties_index_filename,
|
||||||
storage::io::FileWriter::HasNoFingerprint);
|
storage::io::FileWriter::HasNoFingerprint);
|
||||||
|
|
||||||
// TODO investigate increased peak memory consumption by keeping this in memory now
|
TurnDataExternalContainer turn_data_container;
|
||||||
TurnDataContainer turn_data_container;
|
|
||||||
|
|
||||||
// Loop over all turns and generate new set of edges.
|
// Loop over all turns and generate new set of edges.
|
||||||
// Three nested loop look super-linear, but we are dealing with a (kind of)
|
// Three nested loop look super-linear, but we are dealing with a (kind of)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ BOOST_FUSION_ADAPT_STRUCT(osrm::updater::Segment,
|
|||||||
(decltype(osrm::updater::Segment::to), to))
|
(decltype(osrm::updater::Segment::to), to))
|
||||||
BOOST_FUSION_ADAPT_STRUCT(osrm::updater::SpeedSource,
|
BOOST_FUSION_ADAPT_STRUCT(osrm::updater::SpeedSource,
|
||||||
(decltype(osrm::updater::SpeedSource::speed), speed)
|
(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,
|
BOOST_FUSION_ADAPT_STRUCT(osrm::updater::Turn,
|
||||||
(decltype(osrm::updater::Turn::from), from)
|
(decltype(osrm::updater::Turn::from), from)
|
||||||
(decltype(osrm::updater::Turn::via), via)
|
(decltype(osrm::updater::Turn::via), via)
|
||||||
|
|||||||
+36
-22
@@ -34,6 +34,7 @@
|
|||||||
#include <tbb/parallel_invoke.h>
|
#include <tbb/parallel_invoke.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -62,18 +63,9 @@ inline EdgeWeight convertToDuration(double speed_in_kmh, double distance_in_mete
|
|||||||
if (speed_in_kmh <= 0.)
|
if (speed_in_kmh <= 0.)
|
||||||
return MAXIMAL_EDGE_DURATION;
|
return MAXIMAL_EDGE_DURATION;
|
||||||
|
|
||||||
const double speed_in_ms = speed_in_kmh / 3.6;
|
const auto speed_in_ms = speed_in_kmh / 3.6;
|
||||||
const double duration = distance_in_meters / speed_in_ms;
|
const auto duration = distance_in_meters / speed_in_ms;
|
||||||
return std::max<EdgeWeight>(1, static_cast<EdgeWeight>(std::round(duration * 10.)));
|
return std::max(1, boost::numeric_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.;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
@@ -140,8 +132,6 @@ updateSegmentData(const UpdaterConfig &config,
|
|||||||
const SegmentLookupTable &segment_speed_lookup,
|
const SegmentLookupTable &segment_speed_lookup,
|
||||||
extractor::SegmentDataContainer &segment_data)
|
extractor::SegmentDataContainer &segment_data)
|
||||||
{
|
{
|
||||||
auto weight_multiplier = profile_properties.GetWeightMultiplier();
|
|
||||||
|
|
||||||
std::vector<util::Coordinate> coordinates;
|
std::vector<util::Coordinate> coordinates;
|
||||||
util::PackedVector<OSMNodeID> osm_node_ids;
|
util::PackedVector<OSMNodeID> osm_node_ids;
|
||||||
extractor::files::readNodes(config.node_based_graph_path, coordinates, 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));
|
counters_type(num_counters, 0));
|
||||||
const constexpr auto LUA_SOURCE = 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
|
// 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
|
// warning if the new duration exceeds a heuristic of what a reasonable duration update is
|
||||||
std::unique_ptr<extractor::SegmentDataContainer> segment_data_backup;
|
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]];
|
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
|
||||||
if (auto value = segment_speed_lookup({u, v}))
|
if (auto value = segment_speed_lookup({u, v}))
|
||||||
{
|
{
|
||||||
auto new_duration =
|
auto segment_length = segment_lengths[segment_offset];
|
||||||
convertToDuration(value->speed, segment_lengths[segment_offset]);
|
auto new_duration = convertToDuration(value->speed, segment_length);
|
||||||
auto new_weight =
|
auto new_weight = convertToWeight(*value, segment_length);
|
||||||
convertToWeight(value->weight, weight_multiplier, new_duration);
|
|
||||||
fwd_was_updated = true;
|
fwd_was_updated = true;
|
||||||
|
|
||||||
fwd_weights_range[segment_offset] = new_weight;
|
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]];
|
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
|
||||||
if (auto value = segment_speed_lookup({v, u}))
|
if (auto value = segment_speed_lookup({v, u}))
|
||||||
{
|
{
|
||||||
auto new_duration =
|
auto segment_length = segment_lengths[segment_offset];
|
||||||
convertToDuration(value->speed, segment_lengths[segment_offset]);
|
auto new_duration = convertToDuration(value->speed, segment_length);
|
||||||
auto new_weight =
|
auto new_weight = convertToWeight(*value, segment_length);
|
||||||
convertToWeight(value->weight, weight_multiplier, new_duration);
|
|
||||||
rev_was_updated = true;
|
rev_was_updated = true;
|
||||||
|
|
||||||
rev_weights_range[segment_offset] = new_weight;
|
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)
|
if (config.log_edge_updates_factor > 0)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(segment_data_backup);
|
BOOST_ASSERT(segment_data_backup);
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ OSRM_CUSTOMIZE:=$(OSRM_BUILD_DIR)/osrm-customize
|
|||||||
OSRM_ROUTED:=$(OSRM_BUILD_DIR)/osrm-routed
|
OSRM_ROUTED:=$(OSRM_BUILD_DIR)/osrm-routed
|
||||||
POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js
|
POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js
|
||||||
MD5SUM:=$(SCRIPT_ROOT)/md5sum.js
|
MD5SUM:=$(SCRIPT_ROOT)/md5sum.js
|
||||||
TIMER:=$(SCRIPT_ROOT)/timer.sh
|
TIMER:=$(SCRIPT_ROOT)/timer.js
|
||||||
PROFILE:=$(PROFILE_ROOT)/car.lua
|
PROFILE:=$(PROFILE_ROOT)/car.lua
|
||||||
|
|
||||||
all: data
|
all: data
|
||||||
|
|||||||
Reference in New Issue
Block a user