Merge branch 'master' into sf-starts-with

This commit is contained in:
Siarhei Fedartsou 2024-05-30 19:40:42 +02:00 committed by GitHub
commit 4555ab9e40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 28 additions and 182 deletions

View File

@ -1,6 +1,7 @@
# Unreleased # Unreleased
- Changes from 5.27.1 - Changes from 5.27.1
- Features - Features
- REMOVED: Remove all core-CH left-overs [#6920](https://github.com/Project-OSRM/osrm-backend/pull/6920)
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674) - ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575) - ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
- ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666) - ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666)
@ -23,6 +24,7 @@
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452) - CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc: - Misc:
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918) - CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
- CHANGED: Make constants in PackedVector constexpr. [#6917](https://github.com/Project-OSRM/osrm-backend/pull/6917)
- CHANGED: Use std::variant instead of mapbox::util::variant. [#6903](https://github.com/Project-OSRM/osrm-backend/pull/6903) - CHANGED: Use std::variant instead of mapbox::util::variant. [#6903](https://github.com/Project-OSRM/osrm-backend/pull/6903)
- CHANGED: Bump rapidjson to version f9d53419e912910fd8fa57d5705fa41425428c35 [#6906](https://github.com/Project-OSRM/osrm-backend/pull/6906) - CHANGED: Bump rapidjson to version f9d53419e912910fd8fa57d5705fa41425428c35 [#6906](https://github.com/Project-OSRM/osrm-backend/pull/6906)
- CHANGED: Bump mapbox/variant to version 1.2.0 [#6898](https://github.com/Project-OSRM/osrm-backend/pull/6898) - CHANGED: Bump mapbox/variant to version 1.2.0 [#6898](https://github.com/Project-OSRM/osrm-backend/pull/6898)

View File

@ -21,7 +21,7 @@ var osrm = new OSRM('network.osrm');
**Parameters** **Parameters**
- `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`) - `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
- `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'. - `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', or 'MLD'. Default is 'CH'.
Make sure you prepared the dataset with the correct toolchain. Make sure you prepared the dataset with the correct toolchain.
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore. - `options.shared_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
This requires you to run `osrm-datastore` prior to creating an `OSRM` object. This requires you to run `osrm-datastore` prior to creating an `OSRM` object.

View File

@ -54,14 +54,10 @@ namespace osrm::engine
* *
* In addition, shared memory can be used for datasets loaded with osrm-datastore. * In addition, shared memory can be used for datasets loaded with osrm-datastore.
* *
* You can chose between three algorithms: * You can chose between two algorithms:
* - Algorithm::CH * - Algorithm::CH
* Contraction Hierarchies, extremely fast queries but slow pre-processing. The default right * Contraction Hierarchies, extremely fast queries but slow pre-processing. The default right
* now. * now.
* - Algorithm::CoreCH
* Deprecated, to be removed in v6.0
* Contraction Hierachies with partial contraction for faster pre-processing but slower
* queries.
* - Algorithm::MLD * - Algorithm::MLD
* Multi Level Dijkstra, moderately fast in both pre-processing and query. * Multi Level Dijkstra, moderately fast in both pre-processing and query.
* *
@ -74,7 +70,6 @@ struct EngineConfig final
enum class Algorithm enum class Algorithm
{ {
CH, CH,
CoreCH, // Deprecated, will be removed in v6.0
MLD MLD
}; };

View File

@ -12,7 +12,6 @@ namespace osrm::engine
// Algorithm-dependent heaps // Algorithm-dependent heaps
// - CH algorithms use CH heaps // - CH algorithms use CH heaps
// - CoreCH algorithms use CH
// - MLD algorithms use MLD heaps // - MLD algorithms use MLD heaps
template <typename Algorithm> struct SearchEngineData template <typename Algorithm> struct SearchEngineData

View File

@ -296,24 +296,19 @@ inline engine_config_ptr argumentsToEngineConfig(const Napi::CallbackInfo &args)
{ {
engine_config->algorithm = osrm::EngineConfig::Algorithm::CH; engine_config->algorithm = osrm::EngineConfig::Algorithm::CH;
} }
else if (algorithm_str == "CoreCH")
{
engine_config->algorithm = osrm::EngineConfig::Algorithm::CH;
}
else if (algorithm_str == "MLD") else if (algorithm_str == "MLD")
{ {
engine_config->algorithm = osrm::EngineConfig::Algorithm::MLD; engine_config->algorithm = osrm::EngineConfig::Algorithm::MLD;
} }
else else
{ {
ThrowError(args.Env(), "algorithm option must be one of 'CH', 'CoreCH', or 'MLD'."); ThrowError(args.Env(), "algorithm option must be one of 'CH', or 'MLD'.");
return engine_config_ptr(); return engine_config_ptr();
} }
} }
else if (!algorithm.IsUndefined()) else if (!algorithm.IsUndefined())
{ {
ThrowError(args.Env(), ThrowError(args.Env(), "algorithm option must be a string and one of 'CH', or 'MLD'.");
"algorithm option must be a string and one of 'CH', 'CoreCH', or 'MLD'.");
return engine_config_ptr(); return engine_config_ptr();
} }

View File

@ -153,8 +153,7 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
// number of words per block // number of words per block
static constexpr std::size_t BLOCK_WORDS = (Bits * BLOCK_ELEMENTS) / WORD_BITS; static constexpr std::size_t BLOCK_WORDS = (Bits * BLOCK_ELEMENTS) / WORD_BITS;
// C++14 does not allow operator[] to be constexpr, this is fixed in C++17. static constexpr std::array<WordT, BLOCK_ELEMENTS> initialize_lower_mask()
static /* constexpr */ std::array<WordT, BLOCK_ELEMENTS> initialize_lower_mask()
{ {
std::array<WordT, BLOCK_ELEMENTS> lower_mask; std::array<WordT, BLOCK_ELEMENTS> lower_mask;
@ -170,7 +169,7 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
return lower_mask; return lower_mask;
} }
static /* constexpr */ std::array<WordT, BLOCK_ELEMENTS> initialize_upper_mask() static constexpr std::array<WordT, BLOCK_ELEMENTS> initialize_upper_mask()
{ {
std::array<WordT, BLOCK_ELEMENTS> upper_mask; std::array<WordT, BLOCK_ELEMENTS> upper_mask;
@ -194,7 +193,7 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
return upper_mask; return upper_mask;
} }
static /* constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_lower_offset() static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_lower_offset()
{ {
std::array<std::uint8_t, WORD_BITS> lower_offset; std::array<std::uint8_t, WORD_BITS> lower_offset;
@ -209,7 +208,7 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
return lower_offset; return lower_offset;
} }
static /* constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_upper_offset() static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_upper_offset()
{ {
std::array<std::uint8_t, BLOCK_ELEMENTS> upper_offset; std::array<std::uint8_t, BLOCK_ELEMENTS> upper_offset;
@ -232,7 +231,7 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
return upper_offset; return upper_offset;
} }
static /* constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_word_offset() static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_word_offset()
{ {
std::array<std::uint8_t, BLOCK_ELEMENTS> word_offset; std::array<std::uint8_t, BLOCK_ELEMENTS> word_offset;
@ -246,28 +245,15 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
return word_offset; return word_offset;
} }
// For now we need to call these on object creation
void initialize()
{
lower_mask = initialize_lower_mask();
upper_mask = initialize_upper_mask();
lower_offset = initialize_lower_offset();
upper_offset = initialize_upper_offset();
word_offset = initialize_word_offset();
}
// mask for the lower/upper word of a record // mask for the lower/upper word of a record
// TODO: With C++17 these could be constexpr static constexpr std::array<WordT, BLOCK_ELEMENTS> lower_mask = initialize_lower_mask();
/* static constexpr */ std::array<WordT, BLOCK_ELEMENTS> static constexpr std::array<WordT, BLOCK_ELEMENTS> upper_mask = initialize_upper_mask();
lower_mask /* = initialize_lower_mask()*/; static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> lower_offset =
/* static constexpr */ std::array<WordT, BLOCK_ELEMENTS> initialize_lower_offset();
upper_mask /* = initialize_upper_mask()*/; static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> upper_offset =
/* static constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS> initialize_upper_offset();
lower_offset /* = initialize_lower_offset()*/;
/* static constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS>
upper_offset /* = initialize_upper_offset()*/;
// in which word of the block is the element // in which word of the block is the element
/* static constexpr */ std::array<std::uint8_t, BLOCK_ELEMENTS> word_offset = static constexpr std::array<std::uint8_t, BLOCK_ELEMENTS> word_offset =
initialize_word_offset(); initialize_word_offset();
struct InternalIndex struct InternalIndex
@ -378,27 +364,21 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
PackedVector(std::initializer_list<T> list) PackedVector(std::initializer_list<T> list)
{ {
initialize();
reserve(list.size()); reserve(list.size());
for (const auto value : list) for (const auto value : list)
push_back(value); push_back(value);
} }
PackedVector() { initialize(); }; PackedVector(){};
PackedVector(const PackedVector &) = default; PackedVector(const PackedVector &) = default;
PackedVector(PackedVector &&) = default; PackedVector(PackedVector &&) = default;
PackedVector &operator=(const PackedVector &) = default; PackedVector &operator=(const PackedVector &) = default;
PackedVector &operator=(PackedVector &&) = default; PackedVector &operator=(PackedVector &&) = default;
PackedVector(std::size_t size) PackedVector(std::size_t size) { resize(size); }
{
initialize();
resize(size);
}
PackedVector(std::size_t size, T initial_value) PackedVector(std::size_t size, T initial_value)
{ {
initialize();
resize(size); resize(size);
fill(initial_value); fill(initial_value);
} }
@ -406,7 +386,6 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
PackedVector(util::ViewOrVector<WordT, Ownership> vec_, std::size_t num_elements) PackedVector(util::ViewOrVector<WordT, Ownership> vec_, std::size_t num_elements)
: vec(std::move(vec_)), num_elements(num_elements) : vec(std::move(vec_)), num_elements(num_elements)
{ {
initialize();
} }
// forces the efficient read-only lookup // forces the efficient read-only lookup

View File

@ -58,7 +58,6 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET test_region=monaco SET test_region=monaco
SET test_region_ch=ch\monaco SET test_region_ch=ch\monaco
SET test_region_corech=corech\monaco
SET test_region_mld=mld\monaco SET test_region_mld=mld\monaco
SET test_osm=%test_region%.osm.pbf SET test_osm=%test_region%.osm.pbf
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm% COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
@ -68,18 +67,13 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
MKDIR ch MKDIR ch
XCOPY %test_region%.osrm.* ch\ XCOPY %test_region%.osrm.* ch\
XCOPY %test_region%.osrm ch\ XCOPY %test_region%.osrm ch\
MKDIR corech
XCOPY %test_region%.osrm.* corech\
XCOPY %test_region%.osrm corech\
MKDIR mld MKDIR mld
XCOPY %test_region%.osrm.* mld\ XCOPY %test_region%.osrm.* mld\
XCOPY %test_region%.osrm mld\ XCOPY %test_region%.osrm mld\
%CONFIGURATION%\osrm-contract.exe %test_region_ch%.osrm %CONFIGURATION%\osrm-contract.exe %test_region_ch%.osrm
%CONFIGURATION%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
%CONFIGURATION%\osrm-partition.exe %test_region_mld%.osrm %CONFIGURATION%\osrm-partition.exe %test_region_mld%.osrm
%CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm %CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm
XCOPY /Y ch\*.* ..\test\data\ch\ XCOPY /Y ch\*.* ..\test\data\ch\
XCOPY /Y corech\*.* ..\test\data\corech\
XCOPY /Y mld\*.* ..\test\data\mld\ XCOPY /Y mld\*.* ..\test\data\mld\
unit_tests\%CONFIGURATION%\library-tests.exe unit_tests\%CONFIGURATION%\library-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR

View File

@ -64,7 +64,7 @@ Napi::Object Engine::Init(Napi::Env env, Napi::Object exports)
* ``` * ```
* *
* @param {Object|String} [options={shared_memory: true}] Options for creating an OSRM object or string to the `.osrm` file. * @param {Object|String} [options={shared_memory: true}] Options for creating an OSRM object or string to the `.osrm` file.
* @param {String} [options.algorithm] The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'. * @param {String} [options.algorithm] The algorithm to use for routing. Can be 'CH', or 'MLD'. Default is 'CH'.
* Make sure you prepared the dataset with the correct toolchain. * Make sure you prepared the dataset with the correct toolchain.
* @param {Boolean} [options.shared_memory] Connects to the persistent shared memory datastore. * @param {Boolean} [options.shared_memory] Connects to the persistent shared memory datastore.
* This requires you to run `osrm-datastore` prior to creating an `OSRM` object. * This requires you to run `osrm-datastore` prior to creating an `OSRM` object.

View File

@ -36,13 +36,6 @@ OSRM::OSRM(engine::EngineConfig &config)
// Now, check that the algorithm requested can be used with the data // Now, check that the algorithm requested can be used with the data
// that's available. // that's available.
if (config.algorithm == EngineConfig::Algorithm::CoreCH)
{
util::Log(logWARNING) << "Using CoreCH is deprecated. Falling back to CH";
config.algorithm = EngineConfig::Algorithm::CH;
}
switch (config.algorithm) switch (config.algorithm)
{ {
case EngineConfig::Algorithm::CH: case EngineConfig::Algorithm::CH:

View File

@ -61,7 +61,7 @@ std::istream &operator>>(std::istream &in, EngineConfig::Algorithm &algorithm)
in >> token; in >> token;
boost::to_lower(token); boost::to_lower(token);
if (token == "ch" || token == "corech") if (token == "ch")
algorithm = EngineConfig::Algorithm::CH; algorithm = EngineConfig::Algorithm::CH;
else if (token == "mld") else if (token == "mld")
algorithm = EngineConfig::Algorithm::MLD; algorithm = EngineConfig::Algorithm::MLD;
@ -159,7 +159,7 @@ inline unsigned generateServerProgramOptions(const int argc,
("algorithm,a", ("algorithm,a",
value<EngineConfig::Algorithm>(&config.algorithm) value<EngineConfig::Algorithm>(&config.algorithm)
->default_value(EngineConfig::Algorithm::CH, "CH"), ->default_value(EngineConfig::Algorithm::CH, "CH"),
"Algorithm to use for the data. Can be CH, CoreCH, MLD.") // "Algorithm to use for the data. Can be CH, MLD.") //
("disable-feature-dataset", ("disable-feature-dataset",
value<std::vector<storage::FeatureDataset>>(&config.disable_feature_dataset)->multitoken(), value<std::vector<storage::FeatureDataset>>(&config.disable_feature_dataset)->multitoken(),
"Disables a feature dataset from being loaded into memory if not needed. Options: " "Disables a feature dataset from being loaded into memory if not needed. Options: "

View File

@ -14,20 +14,16 @@ PROFILE:=$(PROFILE_ROOT)/car.lua
all: data all: data
data: ch/$(DATA_NAME).osrm.hsgr corech/$(DATA_NAME).osrm.hsgr mld/$(DATA_NAME).osrm.partition data: ch/$(DATA_NAME).osrm.hsgr mld/$(DATA_NAME).osrm.partition
clean: clean:
-rm -r $(DATA_NAME).* -rm -r $(DATA_NAME).*
-rm -r ch corech mld -rm -r ch mld
ch/$(DATA_NAME).osrm: $(DATA_NAME).osrm ch/$(DATA_NAME).osrm: $(DATA_NAME).osrm
mkdir -p ch mkdir -p ch
cp $(DATA_NAME).osrm.* ch/ cp $(DATA_NAME).osrm.* ch/
corech/$(DATA_NAME).osrm: $(DATA_NAME).osrm
mkdir -p corech
cp $(DATA_NAME).osrm.* corech/
mld/$(DATA_NAME).osrm: $(DATA_NAME).osrm mld/$(DATA_NAME).osrm: $(DATA_NAME).osrm
mkdir -p mld mkdir -p mld
cp $(DATA_NAME).osrm.* mld/ cp $(DATA_NAME).osrm.* mld/
@ -42,10 +38,6 @@ ch/$(DATA_NAME).osrm.hsgr: ch/$(DATA_NAME).osrm $(PROFILE) $(OSRM_CONTRACT)
@echo "Running osrm-contract..." @echo "Running osrm-contract..."
$(TIMER) "osrm-contract\t$@" $(OSRM_CONTRACT) $< $(TIMER) "osrm-contract\t$@" $(OSRM_CONTRACT) $<
corech/$(DATA_NAME).osrm.hsgr: corech/$(DATA_NAME).osrm $(PROFILE) $(OSRM_CONTRACT)
@echo "Running osrm-contract..."
$(TIMER) "osrm-contract\t$@" $(OSRM_CONTRACT) --core=0.5 $<
mld/$(DATA_NAME).osrm.partition: mld/$(DATA_NAME).osrm $(PROFILE) $(OSRM_PARTITION) mld/$(DATA_NAME).osrm.partition: mld/$(DATA_NAME).osrm $(PROFILE) $(OSRM_PARTITION)
@echo "Running osrm-partition..." @echo "Running osrm-partition..."
$(TIMER) "osrm-partition\t$@" $(OSRM_PARTITION) $< $(TIMER) "osrm-partition\t$@" $(OSRM_PARTITION) $<
@ -61,11 +53,6 @@ benchmark: data $(DATA_NAME).requests
$(TIMER) "queries\tCH" "cat $(DATA_NAME).requests | xargs curl &> /dev/null" $(TIMER) "queries\tCH" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"
@cat osrm-routed.pid | xargs kill @cat osrm-routed.pid | xargs kill
@rm osrm-routed.pid @rm osrm-routed.pid
@/bin/sh -c '$(OSRM_ROUTED) --algorithm=CoreCH corech/$(DATA_NAME).osrm > /dev/null & echo "$$!" > osrm-routed.pid'
@sleep 1
$(TIMER) "queries\tCoreCH" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"
@cat osrm-routed.pid | xargs kill
@rm osrm-routed.pid
@/bin/sh -c '$(OSRM_ROUTED) --algorithm=MLD mld/$(DATA_NAME).osrm > /dev/null & echo "$$!" > osrm-routed.pid' @/bin/sh -c '$(OSRM_ROUTED) --algorithm=MLD mld/$(DATA_NAME).osrm > /dev/null & echo "$$!" > osrm-routed.pid'
@sleep 1 @sleep 1
$(TIMER) "queries\tMLD" "cat $(DATA_NAME).requests | xargs curl &> /dev/null" $(TIMER) "queries\tMLD" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"

View File

@ -16,12 +16,10 @@ exports.test_tile = {'at': [17059, 11948, 15], 'size': 159125};
if (process.env.OSRM_DATA_PATH !== undefined) { if (process.env.OSRM_DATA_PATH !== undefined) {
exports.data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "ch/monaco.osrm"); exports.data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "ch/monaco.osrm");
exports.mld_data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "mld/monaco.osrm"); exports.mld_data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "mld/monaco.osrm");
exports.corech_data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "corech/monaco.osrm");
exports.test_memory_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "test_memory"); exports.test_memory_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "test_memory");
console.log('Setting custom data path to ' + exports.data_path); console.log('Setting custom data path to ' + exports.data_path);
} else { } else {
exports.data_path = path.resolve(path.join(__dirname, "../data/ch/monaco.osrm")); exports.data_path = path.resolve(path.join(__dirname, "../data/ch/monaco.osrm"));
exports.mld_data_path = path.resolve(path.join(__dirname, "../data/mld/monaco.osrm")); exports.mld_data_path = path.resolve(path.join(__dirname, "../data/mld/monaco.osrm"));
exports.corech_data_path = path.resolve(path.join(__dirname, "../data/corech/monaco.osrm"));
exports.test_memory_path = path.resolve(path.join(__dirname, "../data/test_memory")); exports.test_memory_path = path.resolve(path.join(__dirname, "../data/test_memory"));
} }

View File

@ -3,7 +3,6 @@ var test = require('tape');
var monaco_path = require('./constants').data_path; var monaco_path = require('./constants').data_path;
var test_memory_file = require('./constants').test_memory_file; var test_memory_file = require('./constants').test_memory_file;
var monaco_mld_path = require('./constants').mld_data_path; var monaco_mld_path = require('./constants').mld_data_path;
var monaco_corech_path = require('./constants').corech_data_path;
test('constructor: throws if new keyword is not used', function(assert) { test('constructor: throws if new keyword is not used', function(assert) {
assert.plan(1); assert.plan(1);
@ -65,13 +64,13 @@ test('constructor: throws if given a non-string/obj argument', function(assert)
test('constructor: throws if given an unkown algorithm', function(assert) { test('constructor: throws if given an unkown algorithm', function(assert) {
assert.plan(1); assert.plan(1);
assert.throws(function() { new OSRM({algorithm: 'Foo', shared_memory: true}); }, assert.throws(function() { new OSRM({algorithm: 'Foo', shared_memory: true}); },
/algorithm option must be one of 'CH', 'CoreCH', or 'MLD'/); /algorithm option must be one of 'CH', or 'MLD'/);
}); });
test('constructor: throws if given an invalid algorithm', function(assert) { test('constructor: throws if given an invalid algorithm', function(assert) {
assert.plan(1); assert.plan(1);
assert.throws(function() { new OSRM({algorithm: 3, shared_memory: true}); }, assert.throws(function() { new OSRM({algorithm: 3, shared_memory: true}); },
/algorithm option must be a string and one of 'CH', 'CoreCH', or 'MLD'/); /algorithm option must be a string and one of 'CH', or 'MLD'/);
}); });
test('constructor: loads MLD if given as algorithm', function(assert) { test('constructor: loads MLD if given as algorithm', function(assert) {
@ -86,22 +85,8 @@ test('constructor: loads CH if given as algorithm', function(assert) {
assert.ok(osrm); assert.ok(osrm);
}); });
test('constructor: loads CoreCH if given as algorithm', function(assert) {
assert.plan(1);
var osrm = new OSRM({algorithm: 'CoreCH', path: monaco_corech_path});
assert.ok(osrm);
});
test('constructor: autoswitches to CoreCH for a CH dataset if capable', function(assert) {
assert.plan(1);
var osrm = new OSRM({algorithm: 'CH', path: monaco_corech_path});
assert.ok(osrm);
});
test('constructor: throws if data doesn\'t match algorithm', function(assert) { test('constructor: throws if data doesn\'t match algorithm', function(assert) {
assert.plan(3); assert.plan(1);
assert.throws(function() { new OSRM({algorithm: 'CoreCH', path: monaco_mld_path}); }, /Could not find any metrics for CH/, 'CoreCH with MLD data');
assert.ok(new OSRM({algorithm: 'CoreCH', path: monaco_path}), 'CoreCH with CH data');
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); }, /Could not find any metrics for MLD/, 'MLD with CH data'); assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); }, /Could not find any metrics for MLD/, 'MLD with CH data');
}); });

View File

@ -2,7 +2,6 @@ var OSRM = require('../../');
var test = require('tape'); var test = require('tape');
var monaco_path = require('./constants').data_path; var monaco_path = require('./constants').data_path;
var monaco_mld_path = require('./constants').mld_data_path; var monaco_mld_path = require('./constants').mld_data_path;
var monaco_corech_path = require('./constants').corech_data_path;
var three_test_coordinates = require('./constants').three_test_coordinates; var three_test_coordinates = require('./constants').three_test_coordinates;
var two_test_coordinates = require('./constants').two_test_coordinates; var two_test_coordinates = require('./constants').two_test_coordinates;
const flatbuffers = require('../../features/support/flatbuffers').flatbuffers; const flatbuffers = require('../../features/support/flatbuffers').flatbuffers;
@ -76,32 +75,6 @@ test('route: routes Monaco on MLD', function(assert) {
}); });
}); });
test('route: routes Monaco on CoreCH', function(assert) {
assert.plan(5);
var osrm = new OSRM({path: monaco_corech_path, algorithm: 'CoreCH'});
osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) {
assert.ifError(err);
assert.ok(route.waypoints);
assert.ok(route.routes);
assert.ok(route.routes.length);
assert.ok(route.routes[0].geometry);
});
});
test('route: routes Monaco and returns a JSON buffer', function(assert) {
assert.plan(6);
var osrm = new OSRM({path: monaco_corech_path, algorithm: 'CoreCH'});
osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, { format: 'json_buffer'}, function(err, result) {
assert.ifError(err);
assert.ok(result instanceof Buffer);
const route = JSON.parse(result);
assert.ok(route.waypoints);
assert.ok(route.routes);
assert.ok(route.routes.length);
assert.ok(route.routes[0].geometry);
});
});
test('route: throws with too few or invalid args', function(assert) { test('route: throws with too few or invalid args', function(assert) {
assert.plan(4); assert.plan(4);
var osrm = new OSRM(monaco_path); var osrm = new OSRM(monaco_path);

View File

@ -14,14 +14,6 @@ BOOST_AUTO_TEST_CASE(test_incompatible_with_mld)
osrm::exception); osrm::exception);
} }
BOOST_AUTO_TEST_CASE(test_compatible_with_corech_fallback)
{
// Note - this tests that given the CoreCH algorithm config option, configuration falls back to
// CH and is compatible with CH data
BOOST_CHECK_NO_THROW(
getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm", osrm::EngineConfig::Algorithm::CoreCH));
}
BOOST_AUTO_TEST_CASE(test_incompatible_with_ch) BOOST_AUTO_TEST_CASE(test_incompatible_with_ch)
{ {
// Can't use the CH algorithm with MLD data // Can't use the CH algorithm with MLD data

View File

@ -18,16 +18,6 @@ BOOST_AUTO_TEST_CASE(test_ch)
OSRM osrm{config}; OSRM osrm{config};
} }
BOOST_AUTO_TEST_CASE(test_corech)
{
using namespace osrm;
EngineConfig config;
config.use_shared_memory = false;
config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/corech/monaco.osrm");
config.algorithm = EngineConfig::Algorithm::CoreCH;
OSRM osrm{config};
}
BOOST_AUTO_TEST_CASE(test_mld) BOOST_AUTO_TEST_CASE(test_mld)
{ {
using namespace osrm; using namespace osrm;

View File

@ -198,18 +198,6 @@ void test_tile_ch(bool use_string_only_api)
BOOST_AUTO_TEST_CASE(test_tile_ch_old_api) { test_tile_ch(true); } BOOST_AUTO_TEST_CASE(test_tile_ch_old_api) { test_tile_ch(true); }
BOOST_AUTO_TEST_CASE(test_tile_ch_new_api) { test_tile_ch(false); } BOOST_AUTO_TEST_CASE(test_tile_ch_new_api) { test_tile_ch(false); }
void test_tile_corech(bool use_string_only_api)
{
// Note: this tests that given the CoreCH algorithm config option, configuration falls back to
// CH and is compatible with CH data
using namespace osrm;
auto osrm =
getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm", osrm::EngineConfig::Algorithm::CoreCH);
validate_tile(osrm, use_string_only_api);
}
BOOST_AUTO_TEST_CASE(test_tile_corech_old_api) { test_tile_corech(true); }
BOOST_AUTO_TEST_CASE(test_tile_corech_new_api) { test_tile_corech(false); }
void test_tile_mld(bool use_string_only_api) void test_tile_mld(bool use_string_only_api)
{ {
using namespace osrm; using namespace osrm;
@ -347,14 +335,6 @@ BOOST_AUTO_TEST_CASE(test_tile_turns_ch_new_api)
{ {
test_tile_turns_ch(osrm::EngineConfig::Algorithm::CH, false); test_tile_turns_ch(osrm::EngineConfig::Algorithm::CH, false);
} }
BOOST_AUTO_TEST_CASE(test_tile_turns_corech_old_api)
{
test_tile_turns_ch(osrm::EngineConfig::Algorithm::CoreCH, true);
}
BOOST_AUTO_TEST_CASE(test_tile_turns_corech_new_api)
{
test_tile_turns_ch(osrm::EngineConfig::Algorithm::CoreCH, false);
}
void test_tile_turns_mld(bool use_string_only_api) void test_tile_turns_mld(bool use_string_only_api)
{ {
@ -432,14 +412,6 @@ BOOST_AUTO_TEST_CASE(test_tile_speeds_ch_new_api)
{ {
test_tile_speeds_ch(osrm::EngineConfig::Algorithm::CH, false); test_tile_speeds_ch(osrm::EngineConfig::Algorithm::CH, false);
} }
BOOST_AUTO_TEST_CASE(test_tile_speeds_corech_old_api)
{
test_tile_speeds_ch(osrm::EngineConfig::Algorithm::CoreCH, true);
}
BOOST_AUTO_TEST_CASE(test_tile_speeds_corech_new_api)
{
test_tile_speeds_ch(osrm::EngineConfig::Algorithm::CoreCH, false);
}
void test_tile_speeds_mld(bool use_string_only_api) void test_tile_speeds_mld(bool use_string_only_api)
{ {
@ -501,14 +473,6 @@ BOOST_AUTO_TEST_CASE(test_tile_node_ch_new_api)
{ {
test_tile_nodes_ch(osrm::EngineConfig::Algorithm::CH, false); test_tile_nodes_ch(osrm::EngineConfig::Algorithm::CH, false);
} }
BOOST_AUTO_TEST_CASE(test_tile_node_corech_old_api)
{
test_tile_nodes_ch(osrm::EngineConfig::Algorithm::CoreCH, true);
}
BOOST_AUTO_TEST_CASE(test_tile_node_corech_new_api)
{
test_tile_nodes_ch(osrm::EngineConfig::Algorithm::CoreCH, false);
}
void test_tile_nodes_mld(bool use_string_only_api) void test_tile_nodes_mld(bool use_string_only_api)
{ {