Skip to content

Commit e9f59b6

Browse files
committed
fix bug introduced in _get_interval_id() by PR#12
- the interval i calculation should follow (MIN_TIME_BUDGET + (i-1)*BUDGET_TIME_INTVL, MIN_TIME_BUDGET + i*BUDGET_TIME_INTVL], where, i is integer and i >= 1.
1 parent e75e457 commit e9f59b6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

engine/path_engine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using std::wcsstr;
1818
using std::wcscmp;
1919

20+
// keep it as legacy support for other packages using this old engine
2021
void shortest_path(int o_node_no,
2122
int node_size,
2223
const int* from_node_no_arr,

path4gmns/accessibility.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ def _get_interval_id(t):
1717
[0, MIN_TIME_BUDGET],
1818
1919
(MIN_TIME_BUDGET + (i-1)*BUDGET_TIME_INTVL, MIN_TIME_BUDGET + i*BUDGET_TIME_INTVL]
20-
where, i is integer and i>=1
20+
where, i is integer and i >= 1
2121
"""
2222
if t < MIN_TIME_BUDGET:
2323
return 0
2424

2525
if ((t-MIN_TIME_BUDGET) % BUDGET_TIME_INTVL) == 0:
26-
return int((t-MIN_TIME_BUDGET) % BUDGET_TIME_INTVL)
26+
return int((t-MIN_TIME_BUDGET) / BUDGET_TIME_INTVL)
2727

28-
return int((t-MIN_TIME_BUDGET) % BUDGET_TIME_INTVL) + 1
28+
return int((t-MIN_TIME_BUDGET) / BUDGET_TIME_INTVL) + 1
2929

3030

3131
def _update_min_travel_time(an, at, min_travel_times, time_dependent, demand_period_id):
@@ -242,6 +242,7 @@ def evaluate_accessibility(ui,
242242

243243
interval_num = _get_interval_id(min(max_min, MAX_TIME_BUDGET)) + 1
244244

245+
# multithreading to reduce output time
245246
t = threading.Thread(
246247
target=_output_accessibility,
247248
args=(min_travel_times, zones, mode, output_dir))
@@ -251,4 +252,4 @@ def evaluate_accessibility(ui,
251252
target=_output_accessibility_aggregated,
252253
args=(min_travel_times, interval_num, zones, ats, output_dir)
253254
)
254-
t.start()
255+
t.start()

0 commit comments

Comments
 (0)