|
79 | 79 | "id": "annoying-berry", |
80 | 80 | "metadata": {}, |
81 | 81 | "source": [ |
82 | | - "Navigate to the target data set directory. In this tutorial, we will use the data set where this Jupyter notebook is located for simplicity. You can check your present working directory (PWD) by the following commnad." |
| 82 | + "Navigate to the target data set directory. In this tutorial, we will use the [data set](https://github.com/jdlph/Path4GMNS/tree/dev/tests) where this Jupyter notebook is located for simplicity. You can check your present working directory (PWD) by the following commnad." |
83 | 83 | ] |
84 | 84 | }, |
85 | 85 | { |
|
293 | 293 | "\n", |
294 | 294 | "Accessiblity defines where you can go given a time budget and a transportation mode (e.g., auto). You can find the number of accessible zones from each zone (zone_accessibility.csv) along with the free flow travel time for each OD pair (od_accessibility.csv).\n", |
295 | 295 | "\n", |
296 | | - "The default mode is 'auto' and the default time budget is 240 minutes. We will come back to multimodal evaluation in a later section." |
| 296 | + "The default mode is 'auto' and the default time budget is 240 minutes. We will come back to multimodal evaluation in a later section.\n", |
| 297 | + "\n", |
| 298 | + "Zone information is necessary for accessibility evaluation." |
297 | 299 | ] |
298 | 300 | }, |
299 | 301 | { |
|
305 | 307 | "source": [ |
306 | 308 | "# no need to load demand file for accessibility evaluation\n", |
307 | 309 | "network = pg.read_network()\n", |
| 310 | + "pg.read_zones(network)\n", |
308 | 311 | "\n", |
309 | 312 | "pg.evaluate_accessibility(network, single_mode=True)" |
310 | 313 | ] |
|
323 | 326 | "3. max accessibility. This metric refers to the zone with the maximum number of accessible zones. \n", |
324 | 327 | "4. mean accessibility. The average number of accessible zones over a bin of zones (corresponding to a specific demographic) given a time budget and a transportation mode.\n", |
325 | 328 | "\n", |
326 | | - "Similar to accessiblity evaluation, the default mode is 'auto' but the default time budget is 60 minutes." |
| 329 | + "Similar to accessiblity evaluation, the default mode is 'auto' but the default time budget is 60 minutes. Zone information is still required here." |
327 | 330 | ] |
328 | 331 | }, |
329 | 332 | { |
|
334 | 337 | "outputs": [], |
335 | 338 | "source": [ |
336 | 339 | "network = pg.read_network()\n", |
| 340 | + "pg.read_zones(network)\n", |
337 | 341 | "\n", |
338 | 342 | "pg.evaluate_equity(network, single_mode=True)" |
339 | 343 | ] |
|
345 | 349 | "source": [ |
346 | 350 | "## 4. Move Foward to Multimodal Evaluation\n", |
347 | 351 | "\n", |
348 | | - "In order to perform multimodal evaluation, the corresponding modes (i.e., agent types) must be presented in settings.yml. It will be parsed by pyyaml (5.1 or higher) to the Python engine at run-time. A sample file looks like blow. You can start from here and modify it towards your own needs.\n", |
| 352 | + "In order to perform multimodal evaluation, the corresponding modes (i.e., agent types) must be presented in settings.yml. It will be parsed by pyyaml (5.1 or higher) to the Python engine at run-time. A sample file looks like blow. You can start from here and modify it towards your own needs. **Note that** the default agent type which is **'a' as type and 'auto' as name must be present in this file**. Otherwise, you will encounter an exception with message \"No AGENT type: a\". We will relax this requirement in a later release.\n", |
349 | 353 | "\n", |
350 | 354 | "```yaml\n", |
351 | 355 | "agents:\n", |
|
464 | 468 | "metadata": {}, |
465 | 469 | "outputs": [], |
466 | 470 | "source": [ |
467 | | - "# no need to load demand file for accessibility evaluation\n", |
468 | 471 | "network = pg.read_network()\n", |
| 472 | + "pg.read_zones(network)\n", |
469 | 473 | "\n", |
470 | 474 | "pg.evaluate_accessibility(network)" |
471 | 475 | ] |
|
488 | 492 | "outputs": [], |
489 | 493 | "source": [ |
490 | 494 | "network = pg.read_network()\n", |
| 495 | + "pg.read_zones(network)\n", |
491 | 496 | "\n", |
492 | 497 | "pg.evaluate_equity(network)" |
493 | 498 | ] |
|
590 | 595 | "source": [ |
591 | 596 | "## 7. Legacy Way to Load Demand and Zone Info\n", |
592 | 597 | "\n", |
593 | | - "The legacy way to load demand is via read_network() by speicifying \"load_demand=True\". We have **deprecated** it and switch to the new way demonstrated in **Section 3.2**. If you came to Path4GMNS before v0.8.6, you probably notice that \"load_demand=True\" was not required as demand will be loaded by default. This is one of the changes introduced in v0.8.6. The legacy way are still used in [demo.py](https://github.com/jdlph/Path4GMNS/blob/dev/tests/demo.py) and the code examples in [User Manual](https://github.com/jdlph/Path4GMNS/tree/dev#user-manual), which will be updated gradually over time.\n", |
| 598 | + "### A Little Bit of History\n", |
| 599 | + "\n", |
| 600 | + "During the early development of Path4GMNS, demand.csv is presumed to be given and zone information is provided along node.csv. The latter is the current design of GMNS and is endorsed in [OSM2GMNS](https://github.com/jiawlu/OSM2GMNS). This assumption leads to the following legacy way (as the original design of Path4GMNS) to load demand and zone information while the new way demonstrated was in **Section 3.2**. \n", |
| 601 | + "\n", |
| 602 | + "```python\n", |
| 603 | + "network = pg.read_network(load_demand=True)\n", |
| 604 | + "```\n", |
| 605 | + "\n", |
| 606 | + "The demand file is specified in settings.yml as demand.csv. You can change it to any demand file in your PWD. This design actually allows us to load multiple demand files simultaneously corresponding to different period and agent_type. We will elaborate it in a future release.\n", |
| 607 | + "\n", |
| 608 | + "```yaml\n", |
| 609 | + "---\n", |
| 610 | + "# settings for Path4GMNS\n", |
| 611 | + "agents:\n", |
| 612 | + " - type: a\n", |
| 613 | + " name: auto\n", |
| 614 | + " vot: 10\n", |
| 615 | + " flow_type: 0\n", |
| 616 | + " pce: 1\n", |
| 617 | + " free_speed: 60\n", |
| 618 | + " use_link_ffs: true\n", |
| 619 | + " - type: w\n", |
| 620 | + " name: walk\n", |
| 621 | + " vot: 10\n", |
| 622 | + " flow_type: 0\n", |
| 623 | + " pce: 1\n", |
| 624 | + " free_speed: 10\n", |
| 625 | + " use_link_ffs: false\n", |
| 626 | + "\n", |
| 627 | + "demand_periods:\n", |
| 628 | + " - period: AM\n", |
| 629 | + " time_period: 0700_0800\n", |
| 630 | + "\n", |
| 631 | + "demand_files:\n", |
| 632 | + " - file_name: demand.csv\n", |
| 633 | + " format_type: column\n", |
| 634 | + " period: AM\n", |
| 635 | + " agent_type: a\n", |
594 | 636 | "\n", |
595 | | - "read_network(load_demand=True) will automatically check OD connectivity which **requires zone info to be specified in node.csv**. Otherwise, you will get an exception stating \"NO VALID OD VOLUME!! DOUBLE CHECK YOUR demand.csv\". \n", |
| 637 | + "```\n", |
| 638 | + "If you came to Path4GMNS before v0.8.6, you probably notice that \"load_demand=True\" was not required as demand will be loaded by default. This is one of the changes introduced in v0.8.6 to better promote the new way of loading demand. The legacy way are still used in [demo.py](https://github.com/jdlph/Path4GMNS/blob/dev/tests/demo.py) and the code examples in [User Manual](https://github.com/jdlph/Path4GMNS/tree/dev#user-manual), which will be updated gradually over time. You can still use this legacy way with the [existing sample data sets](https://github.com/jdlph/Path4GMNS/tree/dev/data), which do not have zone.csv but have zone information in node.csv. \n", |
596 | 639 | "\n", |
597 | | - "Here, we still present how to use this legacy way to find paths for agents and conduct traffic assigment. You can use it with the existing [sample data sets](https://github.com/jdlph/Path4GMNS/tree/dev/data), which do not have zone.csv. \n", |
| 640 | + "**Note that** read_network(load_demand=True) will **automatically check OD connectivity** which **requires zone info to be specified in node.csv**. Otherwise, you will get an exception stating \"NO VALID OD VOLUME!! DOUBLE CHECK YOUR demand.csv\". \n", |
598 | 641 | "\n", |
599 | | - "### Find Shortest Paths for All Individual Agents" |
| 642 | + "### 7.1 Find Shortest Paths for All Individual Agents" |
600 | 643 | ] |
601 | 644 | }, |
602 | 645 | { |
|
606 | 649 | "metadata": {}, |
607 | 650 | "outputs": [], |
608 | 651 | "source": [ |
| 652 | + "# zone info must be present in node.csv\n", |
| 653 | + "# demand.csv must be given\n", |
609 | 654 | "network = pg.read_network(load_demand=True)\n", |
610 | 655 | "network.find_path_for_agents()\n", |
611 | 656 | "\n", |
612 | | - "agent_id = 300\n", |
| 657 | + "agent_id = 1\n", |
613 | 658 | "print('\\norigin node id of agent is '\n", |
614 | 659 | " f'{network.get_agent_orig_node_id(agent_id)}')\n", |
615 | 660 | "print('destination node id of agent is '\n", |
|
619 | 664 | "print('shortest path (link id) of agent, '\n", |
620 | 665 | " f'{network.get_agent_link_path(agent_id)}')\n", |
621 | 666 | "\n", |
622 | | - "agent_id = 1000\n", |
| 667 | + "agent_id = 100\n", |
623 | 668 | "print('\\norigin node id of agent is '\n", |
624 | 669 | " f'{network.get_agent_orig_node_id(agent_id)}')\n", |
625 | 670 | "print('destination node id of agent is '\n", |
|
640 | 685 | "id": "insured-electronics", |
641 | 686 | "metadata": {}, |
642 | 687 | "source": [ |
643 | | - "### Perform Path-Based UE Traffic Assignment" |
| 688 | + "### 7.2 Perform Path-Based UE Traffic Assignment" |
644 | 689 | ] |
645 | 690 | }, |
646 | 691 | { |
|
650 | 695 | "metadata": {}, |
651 | 696 | "outputs": [], |
652 | 697 | "source": [ |
| 698 | + "# zone info must be present in node.csv\n", |
| 699 | + "# demand.csv must be given\n", |
653 | 700 | "network = pg.read_network(load_demand=True)\n", |
654 | 701 | "\n", |
655 | | - "column_gen_num = 20\n", |
| 702 | + "column_gen_num = 10\n", |
656 | 703 | "column_update_num = 10\n", |
657 | 704 | "\n", |
658 | 705 | "# path-based UE only\n", |
|
663 | 710 | "pg.output_columns(network)\n", |
664 | 711 | "pg.output_link_performance(network)" |
665 | 712 | ] |
| 713 | + }, |
| 714 | + { |
| 715 | + "cell_type": "markdown", |
| 716 | + "id": "5d68b5d7", |
| 717 | + "metadata": {}, |
| 718 | + "source": [ |
| 719 | + "### 7.3 Evaluate Multimodal Accessibility" |
| 720 | + ] |
| 721 | + }, |
| 722 | + { |
| 723 | + "cell_type": "code", |
| 724 | + "execution_count": null, |
| 725 | + "id": "4b3decc8", |
| 726 | + "metadata": {}, |
| 727 | + "outputs": [], |
| 728 | + "source": [ |
| 729 | + "# zone info must be present in node.csv\n", |
| 730 | + "# no need to load demand file for accessibility evaluation\n", |
| 731 | + "network = pg.read_network()\n", |
| 732 | + "\n", |
| 733 | + "pg.evaluate_accessibility(network)" |
| 734 | + ] |
| 735 | + }, |
| 736 | + { |
| 737 | + "cell_type": "markdown", |
| 738 | + "id": "6226ee32", |
| 739 | + "metadata": {}, |
| 740 | + "source": [ |
| 741 | + "### 7.4 Evaluate Multimodal Equity" |
| 742 | + ] |
| 743 | + }, |
| 744 | + { |
| 745 | + "cell_type": "code", |
| 746 | + "execution_count": null, |
| 747 | + "id": "87a65ad8", |
| 748 | + "metadata": {}, |
| 749 | + "outputs": [], |
| 750 | + "source": [ |
| 751 | + "# zone info must be present in node.csv\n", |
| 752 | + "# no need to load demand file for accessibility evaluation\n", |
| 753 | + "network = pg.read_network()\n", |
| 754 | + "\n", |
| 755 | + "pg.evaluate_equity(network)" |
| 756 | + ] |
666 | 757 | } |
667 | 758 | ], |
668 | 759 | "metadata": { |
|
0 commit comments