Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better network skimming and path computation headers and typo fix #474

Merged
merged 1 commit into from
Dec 3, 2023

Conversation

Jake-Moss
Copy link
Contributor

No description provided.

@jamiecook jamiecook merged commit 8675f64 into AequilibraE:develop Dec 3, 2023
32 checks passed
pedrocamargo added a commit that referenced this pull request Dec 16, 2023
* Models with no centroids (#472)

* Bumps up version for release

* Bumps up version for release

* docs

---------

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Better network skimming and path computation headers and typo fix (#474)

* Integration scaffolding

* Transit assignment

* Change "id" variable naming to avoid double underscores

Double underscore variables are difficult to inherit without duplicating. I've tried my best to group all these renames
into a single commit to be revertible but some others are deep within a refactor.

This changes the convention of using `__id__` and `__graph_id__` to `_id` and `_graph_id`. Since these variables need to
be accessible to other methods they are not private. The double underscore worked previously since there was only ever
one class with these variables the name mangling was always correct.

* Create GraphBase and TransitGraph classes

* Create TransportClassBase and TransitClass classes

* Create AssignmentBass and TransitAssignment classes

* Create AssignmentResultsBase and AssignmentResultsTransit classes

* Comments, add OptimalStrategies class

* Incomplete (full) workflow

* fixup! Incomplete (full) workflow

* fixes export of omx matrices (#484)

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Move periods table

* Lots of changes

Limit graph loading and saving to a single graph for now
Flush out results API, including saving and loading
Move unrelated variables and methods

* Add Periods and Period classes, similar to Nodes and Links classes

* Remove period from database saving for now

* Propagate period ids and various changes

* Raise nicer errors

* Style

* removes use of necessary sqlite3 connection cursors and cached connections (#478)

* removes use of necessary sqlite3 connection cursors

* removes use of necessary sqlite3 connection cursors and saved connections

* removes silly use of a cursor

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

---------

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Migrate docs to new api, fix reloading graphs and begin updating tests.

* Style and build errors

* Typing

* Revert changes to HyperpathGenerating and tests, use arrays instead

* Exclude abstract methods from coverage tests

* Period, Periods, TransitGraph, and TransitGraphBuilder tests

* Style

* Cleans graph creation (#482)

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Adds support page (#481)

* updates examples

* updates examples

* Lower coverage requirement, typos

* Remove patches

* updates examples

* fixup! Remove patches

* Missing var

* Deprecates Python 3.7

* Fixes documentation

* Fixes documentation

* code cleaning

* code cleaning

* code cleaning

* updates setup classifiers

* Fixes centroid assignment

---------

Co-authored-by: Pedro Camargo <c@margo.co>
Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
pedrocamargo added a commit that referenced this pull request Dec 16, 2023
* file transfer from the edsger package: shortest hyperpath algorithm

* first try on compiling the public transport module

* added the COO to CSC sparse format converter

* Python interface to the Cythonized Spiess & Florian algorithm

* assignment loop

* just making sure zero entries are removed from the demand matrix

* Spiess & Florian test case

* assign method S&F test

* added some compiler directives

* combined cdefs

* moved the allocation of f_i_vec outside of compute_SF_in

* cleanup

* moved the allocation of u_j_c_a_vec outside of compute_SF_in

* cleanup

* removed np.sum()

* moved the allocation of u_i_vec outside of compute_SF_in

* added a wrapper of the C function nqsort, in order to replace np.argsort

* moved the allocation of edges_indices outside of compute_SF_in

* released the gil in compute_SF_in

* comment fix

* added the initialization of the edge volume vector

* Attempt parallelising PuT assignment

* Further progress towards parallelisation

* initialized the module for the S&F transit graph creation

* handle the case of int data given as a float string

* renaming

* Complete parallelisation of PuT assignment over destinations

* u_j_c_a_vec was being initialised to an incorrect size

* Move parallelised call to compute_SF_in to separate function

Introduced new accumulation buffer and dropped reacquisition of the gil

* Use numpy asserts for nicer error messages

Using default tolerances of previous asserts

* Restore HyperpathGenerating.run() functionality

* Style

* create stop vertices

* renamed a column

* Fix openmp Windows

* Spelling and default to using all available threads

* Fix default thread amount

* Move hyperpath testing and adjust testing structure

Adds new parallel agreement test as well

* Credit Bell's network construction

* added the class global structure

* using nullable Int type

* filtering stops on a given time period

* filtering patterns, routes ans building a line segment dataframe

* bug fix

* bug fix + filtering the stops corresponding to the given time range

* removed a comment : segment index are 0-based and not 1-based as specifed before

* created a method for the line segments dataframe + now creating the boarding vertices dataframe

* creating the amighting vertices dataframe

* concatenating all the vertex dataframe into a single one

* computation the mean travel time for each (pattern, seq) couple

* fixes the segment travel time computation

* now creating the on-board edges

* Add create_od_vertices()

* Use sql over shape file, data must be mirgated to sqlite first.

* Add creation of connector edges

* Add attempt at dwell and inner transfer edges

* Add missing import

* small update

* temporarily using 2 sqlite connections in the parameters

* renaming within the SQL query

* dwell edges creation

* small code simplifcation

* alighting edges creation

* cleanup

* wip

* compute the mean headway

* renaming

* filling travel time missing values with travel times computed over all the trips_schedule (now limited to the given time range)

* fixed the mean headway computation part

* variable renaming

* boarding edges creation

* concatenate the edges of different types

* added a projected CRS to compute distances

* now merging within the SQL

* cleanup

* updated the connector edges creation

* creation of the inner stop transfer edges

* ability to add spatial noise to boarding and alighting vertex coordinates in order to visualize boarding, aligthing, transfer and collocated on-board edges

* creation of the outer stop transfer edges

* cleanup + divided the connector type into 2 types: access and egress

* added a boolean argument to activate the creation of the outer stop transfer edges

* creating some walking edges between the stops of a station

* Add overlapping regions for connectors construction.

Fix references to graph instead of self

* Fix missing edges, add max distance

* Fix memory blowout by joining on null and empty strings entries

* wip

* renaming + merge

* typo

* casting all stop and parent_station ids to text in sql queries

* Using consistent data types during graph transit creation

* fixed the cython compilation : added a noexcept in the declaration of _compare

* revert to the sequential assignment algorithm (in order to compile)

* comments + initialization

* Add preliminary db saving

Usage:
```python
graph = SF_graph_builder(pt_con, prj_con)
graph.create_vertices()
graph.create_edges()
graph.create_additional_db_fields()
graph.save_vertices()
graph.save_edges()
```

Caveats are noted in the comments of the functions.

* Add shifting for duplicated geometry when saving

* IDs should be index from 1

Allows the whole graph to be read back into aequilibrae

* Rename terms to be more consistent with AequilibraE, use wkb as well

We know use WKB format consistently and only convert out when need. String manipulation and regexs
have also been replaced.

type -> node_type, link_type
head_vert_id -> a_node
tail_vert_id -> b_node
coord -> geometry
vert_id -> node_id
edge_id -> link_id

* Copy over SQL specs for move from proj db to transit storage

* Mirror more triggers and tables into transit db

Includes files copied from network triggers with slight modifications

Need to remove unnecessary columns from links and nodes tables.

Zones are still saved to project db and also need to be migrated.

* renamed some variables

* moved the haversine distance function to the utils submodule

* comments

* Add custom loading of zones to drop dependence on project db

* revert back to the parallel version

* added Jake's fix to support Cython 3

* some code cleaning in the travel time computation

* Style

* cleanup and refactoring

* Add direction and to aeq graph conversion

* Integrate results saving for hp assignment

* typo

* Misc post merge fixes and formatting

* wip

* Add missing results.sql

* SQL query update

* comments

* sql update + public attributes made private

* More consistent datatypes

This does include a change to make stop_ids TEXT with sqlite. I haven't full explored the effects of this change.

* tried to fix an issue with some inverted tail and head IDs for access and egress connectors

* set the edge direction attribute to 1 for all edges (all edges are directed)

* quick fix to drop duplicated transfer edges

* now creating distinct origin and destination nodes

* now supporting the blocking_centroid_flows mode when creating the transit graph, where the origin and destination nodes are distinct

* added a method to convert taz ids to node ids in the demand matrix

* added the max_connectors_per_zone parameter to select at most k connectors per zone with smallest travel time

* Scipy 1.6 is 2 years old, prefer KDTree over the cKDTree alias

* Add initial connect project matching

* Allow troublesome triggers to be disabled

* Improvements on the project line string matching. Not complete

* Project matching progress

* Mimic changes in #455

* fixup! Allow troublesome triggers to be disabled

* PathResults.compute_path fix stale variables

Previously if a path that exists was computed, and then a path that does not exist was attempted, the old path variables
were not cleared.

* Working project matching

* Use existing line string data for a better result

* Refactor project matching into smaller method, add more detailed doc

* Misc doc changes + include trigger_settings in db creation

* Allow supplying zones as shapely objects, by default add zone

* Allow specifying the graph to match against

* Style

* Adjust to_aeq method to reflect other changes

* Use the constructed RNG generator

* Documentation overhaul

Format doc strings to RST. HTML generated docs look correct. Not sure how to set the class included in the TOC.

* Pandas warning fix

* Add Coquimbo public transit assignment example

* fixup! Add Coquimbo public transit assignment example

* updated the docstrings and default values

* include SF_graph_builder in the API documentation

* made many methods protected

* updated the graph builder docstring

* bug fix in the case where there is no transfer edges

* uniform argument naming when calling pd.read_sql

* bug fix dealing with the case of creating walking edges without any parent station

* used a newer pandas method to remove future warning

* new documentation about transit graph creation

* images associated with the transit graph documentation

* structure of a new documentation page

* completed the hyperpath documentation page

* more documentation (HyperpathGenerating)

* fix: added dwell edges

* PT Integration (#476)

* Models with no centroids (#472)

* Bumps up version for release

* Bumps up version for release

* docs

---------

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Better network skimming and path computation headers and typo fix (#474)

* Integration scaffolding

* Transit assignment

* Change "id" variable naming to avoid double underscores

Double underscore variables are difficult to inherit without duplicating. I've tried my best to group all these renames
into a single commit to be revertible but some others are deep within a refactor.

This changes the convention of using `__id__` and `__graph_id__` to `_id` and `_graph_id`. Since these variables need to
be accessible to other methods they are not private. The double underscore worked previously since there was only ever
one class with these variables the name mangling was always correct.

* Create GraphBase and TransitGraph classes

* Create TransportClassBase and TransitClass classes

* Create AssignmentBass and TransitAssignment classes

* Create AssignmentResultsBase and AssignmentResultsTransit classes

* Comments, add OptimalStrategies class

* Incomplete (full) workflow

* fixup! Incomplete (full) workflow

* fixes export of omx matrices (#484)

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Move periods table

* Lots of changes

Limit graph loading and saving to a single graph for now
Flush out results API, including saving and loading
Move unrelated variables and methods

* Add Periods and Period classes, similar to Nodes and Links classes

* Remove period from database saving for now

* Propagate period ids and various changes

* Raise nicer errors

* Style

* removes use of necessary sqlite3 connection cursors and cached connections (#478)

* removes use of necessary sqlite3 connection cursors

* removes use of necessary sqlite3 connection cursors and saved connections

* removes silly use of a cursor

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

* improves on connection styles

---------

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Migrate docs to new api, fix reloading graphs and begin updating tests.

* Style and build errors

* Typing

* Revert changes to HyperpathGenerating and tests, use arrays instead

* Exclude abstract methods from coverage tests

* Period, Periods, TransitGraph, and TransitGraphBuilder tests

* Style

* Cleans graph creation (#482)

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Adds support page (#481)

* updates examples

* updates examples

* Lower coverage requirement, typos

* Remove patches

* updates examples

* fixup! Remove patches

* Missing var

* Deprecates Python 3.7

* Fixes documentation

* Fixes documentation

* code cleaning

* code cleaning

* code cleaning

* updates setup classifiers

* Fixes centroid assignment

---------

Co-authored-by: Pedro Camargo <c@margo.co>
Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* renaming

---------

Co-authored-by: djfrancesco <pacullfrancois@gmail.com>
Co-authored-by: Jake Moss <jake.moss@uqconnect.edu.au>
Co-authored-by: François Pacull <35044397+djfrancesco@users.noreply.github.com>
Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants