Skip to content

Commit e9ed456

Browse files
committed
polish docs for release
- restrict benchmark_apsp() to normal nodes in case centroids are added to the network.
1 parent 6476a32 commit e9ed456

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $ pip install path4gmns
3838
> v0.9.10 comes with bug fix on [find_shortest_path()](https://github.com/jdlph/Path4GMNS/issues/58), new functionality on obtaining the shortest path tree, and performance improvement on the UE module. Please **discard all old versions**.
3939
4040
> [!WARNING]
41-
> The path cost from find_shortest_path() is in travel time rather than distance for v0.9.9.post1 and any earlier versions. See [Issue #58](https://github.com/jdlph/Path4GMNS/issues/58) for details. v0.9.10 offers the correct implementation.
41+
> find_shortest_path() computes the shortest path per travel time rather than distance for v0.9.9.post1 and any earlier versions. See [Issue #58](https://github.com/jdlph/Path4GMNS/issues/58) for details. v0.9.10 offers the correct implementation with the flexibility to switch between time and distance.
4242
4343
> [!WARNING]
4444
> Invoking find_shortest_path() and find_ue() in the same code snippet will lead to [OSError: exception: access violation reading ...](https://github.com/jdlph/Path4GMNS/issues/51#issue-2601430024) for v0.9.9 and any version before.

docs/source/usecases.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ print('\nshortest path (link id) from node 1 to node 2, '
4444
+network.find_shortest_path(1, 2, seq_type='link'))
4545
```
4646

47-
Retrieving the shortest path between any two (different) nodes under a specific mode is now available under v0.7.2 or higher.
47+
Retrieving the shortest path between any two (different) nodes under a specific mode is available under v0.7.2 or higher.
4848
```python
4949
import path4gmns as pg
5050

@@ -91,29 +91,32 @@ import path4gmns as pg
9191

9292
network = pg.read_network()
9393

94-
# get shortest path tree (in node sequences) from node 1 (cost is measured by time (in minutes))
94+
# get shortest path tree (in node sequences) from node 1
95+
# cost is measured by time (in minutes)
9596
sp_tree_node = network.get_shortest_path_tree(1)
9697
# retrieve the shortest path from the source node (i.e., node 1) to node 2
9798
print(f'shortest path (node id) from node 1 to node 2: {sp_tree_node[2]}')
9899
# retrieve the shortest path from the source node (i.e., node 1) to node 3
99100
print(f'shortest path (node id) from node 1 to node 3: {sp_tree_node[3]}')
100101

101-
# get shortest path tree (in link sequences) from node 1 (cost is measured by time (in minutes))
102+
# get shortest path tree (in link sequences) from node 1
103+
# cost is measured by time (in minutes)
102104
sp_tree_link = network.get_shortest_path_tree(1, seq_type='link')
103105
# retrieve the shortest path from the source node (i.e., node 1) to node 2
104106
print(f'shortest path (link id) from node 1 to node 2: {sp_tree_link[2]}')
105107
# retrieve the shortest path from the source node (i.e., node 1) to node 3
106108
print(f'shortest path (link id) from node 1 to node 3: {sp_tree_link[3]}')
107109
```
108110

109-
Similarly, you can get the distance-based shortest path tree as well. The distance unit is in line with the one passed to read_network(), which is miles by default.
111+
Similarly, you can get the distance-based shortest path tree as well. The distance unit is in line with the one passed to read_network().
110112

111113
```python
112114
import path4gmns as pg
113115

114116
network = pg.read_network()
115117

116-
# get shortest path tree (in node sequences) from node 1 (cost is measured by distance (in miles))
118+
# get shortest path tree (in node sequences) from node 1
119+
# cost is measured by distance (in miles)
117120
sp_tree_node = network.get_shortest_path_tree(1, cost_type='distance')
118121
# retrieve the shortest path from the source node (i.e., node 1) to node 2
119122
print(f'shortest path (node id) from node 1 to node 2: {sp_tree_node[2]}')
@@ -135,14 +138,16 @@ import path4gmns as pg
135138

136139
network = pg.read_network()
137140

138-
# get shortest path tree (in node sequences) from node 1 (cost is measured by time) under mode 'w'
141+
# get shortest path tree (in node sequences) from node 1 under mode 'w'
142+
# cost is measured by time (in minutes)
139143
sp_tree_node = network.get_shortest_path_tree(1, mode='w')
140144
# retrieve the shortest path from the source node (i.e., node 1) to node 2
141145
print(f'shortest path (node id) from node 1 to node 2: {sp_tree_node[2]}')
142146
# retrieve the shortest path from the source node (i.e., node 1) to node 3
143147
print(f'shortest path (node id) from node 1 to node 3: {sp_tree_node[3]}')
144148

145-
# get shortest path tree (in link sequences) from node 1 (cost is measured by distance) under mode 'w'
149+
# get shortest path tree (in link sequences) from node 1 under mode 'w'
150+
# cost is measured by distance
146151
sp_tree_link = network.get_shortest_path_tree(1, mode='w', seq_type='link', cost_type='distance')
147152
# retrieve the shortest path from the source node (i.e., node 1) to node 2
148153
print(f'shortest path (link id) from node 1 to node 2: {sp_tree_link[2]}')
@@ -192,7 +197,7 @@ pg.output_columns(network)
192197
pg.output_link_performance(network)
193198
```
194199

195-
v0.9.10 provides users more flexibility to control UE convergency by returning the relative gap and passing the relative gap tolerance (i.e., the target relative gap). find_ue() will terminate when either column_upd_num or rel_gap_tolerance is reached.
200+
v0.9.10 provides users more flexibility to control UE convergency with the relative gap tolerance (i.e., the target relative gap). find_ue() will terminate when either column_upd_num or rel_gap_tolerance is reached and return the final relative gap.
196201
```python
197202
import path4gmns as pg
198203

@@ -215,7 +220,7 @@ pg.output_link_performance(network)
215220

216221
### In Case of Special Events
217222

218-
A special event often comes with capacity reduction over affected links, which is now supported in v0.8.4 or higher. You can introduce one special event for each demand period in settings.yml as below.
223+
A special event often comes with capacity reduction over affected links, which is supported in v0.8.4 or higher. You can introduce one special event for each demand period in settings.yml as below.
219224

220225
```yaml
221226
demand_periods:

path4gmns/dtaapi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def perform_network_assignment_DTALite(assignment_mode,
4545
WARNING
4646
-------
4747
MAKE SURE TO BACKUP route_assignment.csv and link_performance.csv if you have
48-
called perform_network_assignment() before. Otherwise, they will be
49-
overwritten by results generated by DTALite.
48+
called find_ue() before. Otherwise, they will be overwritten by results
49+
generated by DTALite.
5050
5151
Parameters
5252
----------
@@ -162,7 +162,7 @@ def run_DTALite():
162162
Only use the following data set from
163163
https://github.com/asu-trans-ai-lab/DTALite/tree/feature/multimodal/data.
164164
165-
Please run the script calling this API using system terminal rather than
165+
Please run the script calling this API using your system terminal rather than
166166
Python console for proper logging.
167167
"""
168168
_dtalitemm_engine = ctypes.cdll.LoadLibrary(_dtalitemm_dll)

path4gmns/path.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ def benchmark_apsp(G):
246246
st = time()
247247

248248
for k in G.map_id_to_no:
249+
# do not include centroids
250+
if G.map_id_to_no[k] >= G.get_last_thru_node():
251+
break
252+
249253
single_source_shortest_path(G, k)
250254

251255
print(f'processing time of finding all-pairs shortest paths: {time()-st:.4f} s')

tutorial/tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@
832832
"\n",
833833
"Starting from v0.9.6, you could conduct the above tasks using the [Multimodal DTALite](https://github.com/asu-trans-ai-lab/DTALite/tree/feature/multimodal). No parameters are needed. \n",
834834
"\n",
835-
"Note that running it with the current input will lead to *kernel crash* as it requires a **different [settings.yml](https://github.com/asu-trans-ai-lab/DTALite/blob/feature/multimodal/data/01_4_node_network/minimum_input/settings.yml)**! You can test this API with [this data set](https://github.com/asu-trans-ai-lab/DTALite/tree/feature/multimodal/data). "
835+
"**Note that** running it with the current input will lead to *kernel crash* as it requires a **different [settings.yml](https://github.com/asu-trans-ai-lab/DTALite/blob/feature/multimodal/data/01_4_node_network/minimum_input/settings.yml)**! You can test this API with [this data set](https://github.com/asu-trans-ai-lab/DTALite/tree/feature/multimodal/data). "
836836
]
837837
},
838838
{

0 commit comments

Comments
 (0)