-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add benchmark suite to evauluate perfomance of route finding
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"version": 1, | ||
"project": "routor", | ||
"project_url": "https://github.com/routeco/routor", | ||
|
||
"repo": ".", | ||
"environment_type": "virtualenv", | ||
|
||
|
||
"install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], | ||
"uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], | ||
"build_command": ["python -mpip install poetry", "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"], | ||
|
||
"branches": ["main"], | ||
"show_commit_url": "https://github.com/routeco/routor/commit/", | ||
|
||
"benchmark_dir": "benchmarks", | ||
|
||
"env_dir": ".asv/env", | ||
"results_dir": ".asv/results", | ||
"html_dir": ".asv/html" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
|
||
from routor import weights | ||
from routor.engine import Engine | ||
from routor.models import Location | ||
from routor.utils import graph as graph_utils | ||
|
||
MAP_PATH = Path(".").absolute() / "benchmark_map.graphml" | ||
|
||
|
||
class TimeSuite: | ||
def setup_cache(self): | ||
graph = graph_utils.download_map( | ||
["bristol"], | ||
node_tags=["osmid"], | ||
edge_tags=["junction", "traffic_signals", "surface", "lanes"], | ||
api_key=None, | ||
) | ||
graph_utils.save_map(graph, MAP_PATH) | ||
|
||
def setup(self): | ||
self.engine = Engine(MAP_PATH) | ||
|
||
def time_load_map(self): | ||
Engine(MAP_PATH) | ||
|
||
def time_routing(self): | ||
origin = Location(longitude=-2.583160400390625, latitude=51.43806566801884) | ||
destination = Location( | ||
longitude=-2.6348304748535156, latitude=51.48223813101211 | ||
) | ||
self.engine.route(origin, destination, weights.length, weights.travel_time) | ||
|
||
|
||
if __name__ == "__main__": | ||
suite = TimeSuite() | ||
suite.setup_cache() | ||
suite.setup() | ||
|
||
suite.time_routing() |