This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD - Path discovery and inspection report
Signed-off-by: RaenonX <[email protected]>
- Loading branch information
Showing
24 changed files
with
1,086 additions
and
179 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,23 +1,57 @@ | ||
import time | ||
from datetime import datetime | ||
|
||
from msnmetrosim.views import ( | ||
test_run, | ||
# test_run, | ||
# Simulation graph benchmarking | ||
# benchmark_gen_map, | ||
benchmark_map_construction, | ||
# Simulation benchmark plotting | ||
# gen_map_only_df8d234f | ||
plot_trip_count_cdf, post_152f1000_pruned_no_detouring | ||
) | ||
|
||
|
||
def main(): | ||
test_run() | ||
# Benchmark with pruning, max transfer 1~5 | ||
|
||
travel_time = 1800 | ||
|
||
results = [] | ||
|
||
for max_transfer in range(5): | ||
results.extend(benchmark_map_construction( | ||
datetime(2020, 9, 2, 15), | ||
[travel_time], | ||
(43.069451, -89.401168), | ||
max_transfer=max_transfer | ||
)) | ||
|
||
print(f"{'=' * 50} RESULTS {'=' * 50}") | ||
for max_transfer, result in enumerate(results): | ||
print() | ||
print(f"{'=' * 20} Max transfer = {max_transfer}") | ||
print() | ||
print(result) | ||
|
||
|
||
def main2(): | ||
pass | ||
travel_time = 2700 | ||
|
||
results = benchmark_map_construction( | ||
datetime(2020, 9, 2, 15), | ||
[travel_time], | ||
(43.069451, -89.401168), | ||
) | ||
print(f"{'=' * 50} RESULTS {'=' * 50}") | ||
print() | ||
print(results[0]) | ||
print() | ||
|
||
|
||
def main3(): | ||
plot_trip_count_cdf(post_152f1000_pruned_no_detouring) | ||
|
||
|
||
if __name__ == '__main__': | ||
_start = time.time() | ||
main() | ||
main3() | ||
print(f"Time spent: {(time.time() - _start) * 1000:.3f} ms") |
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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
"""Various utils and helpers.""" | ||
from .calc import normalize_vector, normalize_cumulate_vector | ||
from .colorgen import get_color | ||
from .deco_warning import temporary_func | ||
from .dt_convert import time_from_seconds | ||
from .geo import distance, offset, generate_points, travel_time | ||
from .mixin import TimeableMixin | ||
from .perf import time_function | ||
from .plane import get_plane, Plane | ||
from .plot import plot_twin_y, plot_single, plot_multiple | ||
from .plot import plot_twin_y, plot_single, plot_multiple, plot_discrete_distribution_normalized | ||
from .progress import Progress | ||
from .stats import DataMetrics |
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,27 @@ | ||
"""Functions for easier calculations.""" | ||
from typing import List, Iterable | ||
|
||
__all__ = ("cumulate_vector", "normalize_vector", "normalize_cumulate_vector") | ||
|
||
|
||
def cumulate_vector(vector: Iterable[float]) -> List[float]: | ||
"""Cumulate ``vector``.""" | ||
ret: List[float] = [] | ||
for entry in vector: | ||
ret.append((ret[-1] if len(ret) > 0 else 0) + entry) | ||
|
||
return ret | ||
|
||
|
||
def normalize_vector(vector: Iterable[float]) -> List[float]: | ||
"""Normalize ``vector``, letting the sum of the vector to be 1.""" | ||
total = sum(vector) | ||
|
||
return [item / total for item in vector] | ||
|
||
|
||
def normalize_cumulate_vector(vector: Iterable[float]) -> List[float]: | ||
"""Normalize and cumulate ``vector``.""" | ||
normalized = normalize_vector(vector) | ||
|
||
return cumulate_vector(normalized) |
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
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
Oops, something went wrong.