Skip to content

Commit 14c79c9

Browse files
committed
remove find_path_for_agents from tutorial and doc
- add exception handling to set_capacity_ratio of Assignment; - update use case on loading columns to reflect the latest change on removing the dependency of load_demand().
1 parent 5c355cd commit 14c79c9

File tree

5 files changed

+73
-192
lines changed

5 files changed

+73
-192
lines changed

docs/source/index.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ applications in transportation (e.g., activity-based demand modeling).
1515
Path4GMNS supports, in short,
1616

1717
1. finding (static) shortest path between two nodes,
18-
2. constructing shortest paths for all individual agents,
19-
3. performing path-based User-Equilibrium (UE) traffic assignment,
20-
4. conducting dynamic traffic assignment (DTA) after UE.
21-
5. evaluating multimodal accessibility and equity,
22-
6. synthesizing zones and Origin-Destination (OD) demand for a given network.
18+
2. performing path-based User-Equilibrium (UE) traffic assignment,
19+
3. conducting dynamic traffic assignment (DTA) after UE.
20+
4. evaluating multimodal accessibility and equity,
21+
5. synthesizing zones and Origin-Destination (OD) demand for a given network.
2322

2423
Path4GMNS also serves as an API to the C++-based
2524
`DTALite <https://github.com/jdlph/DTALite>`_ to conduct various multimodal

docs/source/installation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
Installation
33
============
44

5-
Path4GMNS has been published on `PyPI <https://pypi.org/project/path4gmns/0.9.2/>`_, and can be installed using
5+
Path4GMNS has been published on `PyPI <https://pypi.org/project/path4gmns/0.9.3/>`_, and can be installed using
66

77
.. code-block:: bash
88
99
$ pip install path4gmns
1010
11-
If you need a specific version of Path4GMNS, say, 0.9.2,
11+
If you need a specific version of Path4GMNS, say, 0.9.3,
1212

1313
.. code-block:: bash
1414
15-
$ pip install path4gmns==0.9.2
15+
$ pip install path4gmns==0.9.3
1616
1717
1818
Dependency
@@ -55,7 +55,7 @@ As CMAKE_BUILD_TYPE will be IGNORED for IDE (Integrated Development Environment)
5555
# from the root directory of PATH4GMNS
5656
$ python setup.py sdist bdist_wheel
5757
$ cd dist
58-
# or python -m pip install path4gmns-0.9.2.tar.gz
59-
$ python -m pip instal pypath4gmns-0.9.2-py3-none-any.whl
58+
# or python -m pip install path4gmns-0.9.3.tar.gz
59+
$ python -m pip instal pypath4gmns-0.9.3-py3-none-any.whl
6060
61-
Here, 0.9.2 is the version number. Replace it with the one specified in setup.py.
61+
Here, 0.9.3 is the version number. Replace it with the one specified in setup.py.

docs/source/usecases.md

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -114,63 +114,6 @@ pg.output_columns(network)
114114
pg.output_link_performance(network)
115115
```
116116

117-
## Find Shortest Paths for All Individual Agents
118-
Path4GMNS is capable of calculating and constructing the (static) shortest paths for all agents. Individual agents will be automatically set up using the aggregated travel demand between each OD pair (i.e., demand.csv) within find_path_for_agents() on its first call. If you have zone information specified in node.csv, you can also follow the legacy way to load demand and zone info (see [Tutorial](https://github.com/jdlph/Path4GMNS/blob/dev/tests/tutorial.ipynb) for details).
119-
120-
The unique agent paths can be output to a csv file as shown in the example below.
121-
```python
122-
import path4gmns as pg
123-
124-
network = pg.read_network()
125-
# it reads zone.csv by default
126-
pg.read_zones(network)
127-
# it reads demand.csv by default
128-
pg.load_demand(network)
129-
network.find_path_for_agents()
130-
131-
agent_id = 300
132-
print('\norigin node id of agent is '
133-
f'{network.get_agent_orig_node_id(agent_id)}')
134-
print('destination node id of agent is '
135-
f'{network.get_agent_dest_node_id(agent_id)}')
136-
print('shortest path (node id) of agent, '
137-
f'{network.get_agent_node_path(agent_id)}')
138-
print('shortest path (link id) of agent, '
139-
f'{network.get_agent_link_path(agent_id)}')
140-
141-
agent_id = 1000
142-
print('\norigin node id of agent is '
143-
f'{network.get_agent_orig_node_id(agent_id)}')
144-
print('destination node id of agent is '
145-
f'{network.get_agent_dest_node_id(agent_id)}')
146-
print('shortest path (node id) of agent, '
147-
f'{network.get_agent_node_path(agent_id)}')
148-
print('shortest path (link id) of agent, '
149-
f'{network.get_agent_link_path(agent_id)}')
150-
151-
# output unique agent paths to a csv file
152-
# if you do not want to include geometry info in the output file,
153-
# use pg.output_agent_paths(network, False)
154-
pg.output_agent_paths(network)
155-
```
156-
157-
v0.7.2 or higher features finding agent paths under a specific mode defined in settings.yml. The following example demonstrates this new functionality under mode walk (i.e., w).
158-
```python
159-
import path4gmns as pg
160-
161-
network = pg.read_network()
162-
pg.read_zones(network)
163-
pg.load_demand(network)
164-
165-
network.find_path_for_agents()
166-
167-
# or equivalently network.find_path_for_agents('walk')
168-
network.find_path_for_agents('w')
169-
170-
# retrieving the origin, the destination, and the shortest path of a given agent
171-
# is exactly the same as before as well as outputting all unique agent paths
172-
```
173-
174117
## Perform Path-Based UE Traffic Assignment using the Python Column-Generation Module
175118
The Python column-generation module only implements path-based UE. If you need other assignment modes, e.g., link-based UE or DTA, please use perform_network_assignment_DTALite().
176119

@@ -532,8 +475,6 @@ If you have agent.csv (i.e.columns) from a previous run or DTALite, you can bypa
532475
import path4gmns as pg
533476

534477
network = pg.read_network()
535-
pg.read_zones(network)
536-
pg.load_demand(network)
537478

538479
# load existing UE result
539480
pg.load_columns(network)

path4gmns/classes.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,11 @@ def set_simu_start_time(self, st):
17181718
self.simu_st = st
17191719

17201720
def set_capacity_ratio(self, tau, link_id, r):
1721-
link_no = self.get_link_seq_no(link_id)
1721+
try:
1722+
link_no = self.get_link_seq_no(link_id)
1723+
except KeyError:
1724+
return
1725+
17221726
link = self.get_link(link_no)
17231727
link.set_capacity_ratio(tau, r)
17241728

@@ -1759,7 +1763,10 @@ def get_ODMatrix(self):
17591763
return self._base_assignment.network.ODMatrix
17601764

17611765
def find_path_for_agents(self, mode='all'):
1762-
""" find and set up shortest path for each agent """
1766+
""" DEPRECATED
1767+
1768+
find and set up shortest path for each agent
1769+
"""
17631770
return self._base_assignment.find_path_for_agents(mode)
17641771

17651772
def find_shortest_path(self, from_node_id, to_node_id,

0 commit comments

Comments
 (0)