Crate routee_compass
source ·Expand description
The RouteE-Compass energy-aware routing engine.
§Crates
This documentation is built around use of the routee_compass
crate.
This repo is setup as a workspace and CompassApp is defined with two upstream dependencies, routee-compass-core and routee-compass-powertrain:
- routee-compass-core - core data structures and algorithms used by Compass
- routee-compass-powertrain - traversal model supporting energy-optimal route planning via RouteE Powertrain
- routee-compass - application built around the core model intended for command-line execution or longer-running applications such as the python sdk (this README)
§Building CompassApp instances
A RouteE Compass app exists as a value of type CompassApp on a given system.
An instance can be built using one of two try_from
methods:
- from a path, which assumes the default CompassAppBuilder
- from an instance of Config along with a (possibly customized) CompassAppBuilder
Customizing a CompassAppBuilder is the extension point for adding 3rd party extensions to CompassApp.
If this is not needed, then sticking to the default is sufficient, via the CompassApp::try_from(path)
builder method.
§Running queries on CompassApp
With a running instance of CompassApp, one can repeatedly issue queries via the run
method:
let path: PathBuf = todo!();
let app = CompassApp::try_from(path)?;
// use vec![query] to run a single query
let queries: Vec<serde_json::Value> = vec![];
let result = app.run(queries);
Based on the parallelism argument to CompassApp, the batch of queries will be split into chunks in a SIMD parallelization scheme across the available system threads. Keep in mind that each chunk needs enough RAM to conduct a search over your road network. For example, if a road network has 1 million links, and parallelism is 8, then (in the worst case) there should be sufficient RAM to store 8 million rows of search data.
§Customizing RouteE Compass
If you wish to add your own features to a CompassApp instance, then see the following links for info on:
- a custom TraversalModelBuilder
- a custom FrontierModelBuilder
- a custom InputPluginBuilder
- a custom OutputPluginBuilder
Any custom builders will need to be added to a CompassAppBuilder instance that should be used to create a CompassApp.