Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
r-akemii committed Aug 30, 2024
1 parent 2821f79 commit ae6f105
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 87 deletions.
2 changes: 1 addition & 1 deletion aequilibrae/paths/linear_approximation.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def calculate_stepsize(self):
self.stepsize = tiny_step
else:
self.stepsize = 0.0
# need to reset conjugate / bi-conjugate direction search
# need to reset conjugate / biconjugate direction search
self.do_fw_step = True
self.conjugate_failed = True
self.iteration_issue.append("Found bad conjugate direction step. Performing FW search. {e.args}")
Expand Down
1 change: 0 additions & 1 deletion docs/source/development/roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ identified and that we intend to dedicate some time to in the future.
* Public Transport

* Export of GTFS (enables editing of GTFS in QGIS)
* Public transit assignment (Scheduled for 3rd Quarter 2023)

* Project

Expand Down
24 changes: 12 additions & 12 deletions docs/source/development/softwaredevelopment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Development Install

As it goes with most Python packages, we recommend using a dedicated virtual environment to develop AequilibraE.

AequilibraE is currently tested for Python 3.7, 3.8, 3.9 & 3.11, but we recommend using Python 3.9 or 2.10 for development.
AequilibraE is currently tested for Python 3.9, 3.10, 3.11 & 3.12, but we recommend using Python 3.9 or 2.10 for
development.

We also assume you are using `PyCharm <https://www.jetbrains.com/pycharm>`_ or `VSCode <https://code.visualstudio.com/>`_
which are awesome IDEs for Python.
We also assume you are using `PyCharm <https://www.jetbrains.com/pycharm>`_ or
`VSCode <https://code.visualstudio.com/>`_ which are awesome IDEs for Python.

If you are using a different IDE, we would welcome if you could contribute with instructions to set that up.

Expand All @@ -39,8 +40,7 @@ Non-Windows
Windows
~~~~~~~

Make sure to clone the AequilibraE repository and run the following from within
that cloned repo using an elevated command prompt.
Make sure to clone the AequilibraE repository and run the following from withinthat cloned repo using an elevated command prompt.

Python 3.9 (or whatever version you chose) needs to be installed, and the
following instructions assume you are using `Chocolatey
Expand Down Expand Up @@ -74,15 +74,16 @@ Style

* Python code should follow (mostly) the `pycodestyle style guide <https://pypi.python.org/pypi/pycodestyle>`_
* Python docstrings should follow the `reStructuredText Docstring Format <https://www.python.org/dev/peps/pep-0287/>`_
* We are big fans of auto-code formatting. For that, we use `Black <https://black.readthedocs.io/en/stable/index.html/>`_
* We are big fans of auto-code formatting.
For that, we use `Black <https://black.readthedocs.io/en/stable/index.html/>`_
* Negating some of what we have said so far, we use maximum line length of 120 characters

Imports
~~~~~~~

* Imports should be one per line.
* Imports should be grouped into standard library, third-party, and intra-library imports (`ctrl+shit+o`
does it automatically on PyCharm).
* Imports should be grouped into standard library, third-party, and intra-library imports
(``ctrl+shit+o`` does it automatically on PyCharm).
* Imports of NumPy and Pandas should follow the following convention:

.. code-block:: python
Expand Down Expand Up @@ -161,8 +162,8 @@ manually review the code before merging it into master (or returning for correct
In some cases, test targets need to be updated to match the new results produced by the code since these
are now the correct results. In order to update the test targets, first determine which tests are
failing and then review the failing lines in the source files. These are easy to identify since each
test ultimately comes down to one of Python's various types of `assert` statements. Once you identify
which `assert` is failing, you can work your way back through the code that creates the test targets in
test ultimately comes down to one of Python's various types of ``assert`` statements. Once you identify
which ``assert`` is failing, you can work your way back through the code that creates the test targets in
order to update it. After updating the test targets, re-run the tests to confirm the new code passes all
the tests.

Expand Down Expand Up @@ -194,8 +195,7 @@ Releases
~~~~~~~~~

AequilibraE releases are automatically uploaded to the `Python Package Index
<https://pypi.python.org/pypi/aequilibrae>`__ (pypi) at each new GitHub release (2 to 6 times per year).

<https://pypi.python.org/pypi/aequilibrae>`_ (pypi) at each new GitHub release (2 to 6 times per year).

Acknowledgement
~~~~~~~~~~~~~~~
Expand Down
7 changes: 5 additions & 2 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ It all started when `Pedro <https://www.xl-optim.com/>`_ was a student at `UCI-I
needed low level access to outputs of standard algorithms used in transportation modeling (e.g. path files from traffic
assignment) and had that denied by the maker of the commercial software he normally used. There, the
`first scratch of a traffic assignment procedure <https://www.xl-optim.com/python-traffic-assignment>`_ was born.

After that, there were a couple of scripts developed to implement synthetic gravity models (calibration and application)
that were developed for a government think-tank in Brazil `IPEA <https://www.ipea.gov.br/>`_.

Around the same time, another student needed a piece of code that transformed a GIS link layer into a proper graph,
where each link would become the connection between two nodes.

So there were three fundamental pieces that would come to be part of AequilibraE.

The first take on a release software
Expand All @@ -27,7 +30,7 @@ Having all those algorithms at hand, it made sense combining them into something
seemed that QGIS was the way to go, so Pedro developed the
`very first version of AequilibraE <http://www.xl-optim.com/introducing_aequilibrae>`_.

It was buggy as hell and there was very little, if any, software engineering built into it, but it put Aequilibrae on
It was buggy as hell and there was very little, if any, software engineering built into it, but it put AequilibraE on
the map. That was 16/December/2014.

The first reasonable version
Expand All @@ -37,7 +40,7 @@ The first important thing Pedro noticed after releasing AequilibraE was that the
even though it would make a lot more sense doing it in an Object-Oriented fashion, which let him down the path of
creating the objects (graph, assignment results, matrix) that the software still relies on and were the foundation
blocks of the proper API that is in the making. That
`version was released in 2016 <http://www.xl-optim.com/new-version-of-aequilibrae>`_
`version was released in 2016 <http://www.xl-optim.com/new-version-of-aequilibrae>`_.

Evolving into proper software
-----------------------------
Expand Down
32 changes: 12 additions & 20 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@
Installation
============

In this section we describe how to install AequilibraE.
In this section we describe how to install AequilibraE. The recommendations on this page are current
as of September 2024.

.. note::
Although AequilibraE is under intense development, we try to avoid making
breaking changes to the API. In any case, you should check for new features
and possible API changes often.

.. note::
The recommendations on this page are current as of December 2023.

.. index:: installation

Installation
------------

1. Install `Python 3.8, 3.9, 3.10, 3.11 or 3.12 <www.python.org>`__. We recommend Python 3.10 or 3.11

1. Install `Python 3.9, 3.10, 3.11 or 3.12 <www.python.org>`_. We recommend Python 3.10 or 3.11
2. Install AequilibraE

::
Expand All @@ -31,11 +28,10 @@ Installation
.. _dependencies:

Dependencies
~~~~~~~~~~~~
------------

All of AequilibraE's dependencies are readily available from `PyPI
<https://www.pypi.org/>`_ for all currently supported Python versions and major
platforms.
All of AequilibraE's dependencies are readily available from `PyPI <https://www.pypi.org/>`_
for all currently supported Python versions and major platforms.

.. _installing_spatialite_on_windows:

Expand All @@ -53,21 +49,21 @@ Windows
^^^^^^^

.. note::
On Windows ONLY, AequilibraE automatically verifies if you have SpatiaLite
On Windows ONLY, AequilibraE automatically verifies if you have Spatialite
installed in your system and downloads it to your temporary folder if you do
not.

Spatialite does not have great support on Python for Windows. For this reason,
it is necessary to download Spatialite for Windows and inform and load it
to the Python SQLite driver every time you connect to the database.

One can download the appropriate version of the latest SpatiaLite release
One can download the appropriate version of the latest Spatialite release
directly from its `project page <https://www.gaia-gis.it/gaia-sins/>`_ , or the
cached versions on AequilibraE's website for
`64-Bit Python <https://github.com/AequilibraE/aequilibrae/releases/tag/V.0.7.5>`_

After unpacking the zip file into its own folder (say *D:/spatialite*), one can
**temporarily** add the spatialite folder to system path environment variable,
After unpacking the zip file into its own folder (say ``D:/spatialite``), one can
*temporarily* add the spatialite folder to system path environment variable,
as follows:

::
Expand All @@ -89,12 +85,11 @@ On Ubuntu it is possible to install Spatialite by simply using apt-get
sudo apt install -y libsqlite3-mod-spatialite
sudo apt install -y libspatialite-dev


MacOS
^^^^^

On MacOS one can use brew as per
`this answer on StackOverflow <https://stackoverflow.com/a/48370444/1480643>`_.
`this answer on Stack Overflow <https://stackoverflow.com/a/48370444/1480643>`_.

::

Expand All @@ -104,13 +99,10 @@ Hardware requirements
---------------------

AequilibraE's requirements depend heavily on the size of the model you are using
for computation. The most important
things to keep an eye on are:
for computation. The most important things to keep an eye on are:

* Number of zones on your model (size of the matrices you are dealing with)

* Number of matrices (vehicles classes (and user classes) you are dealing with)

* Number of links and nodes on your network (far less likely to create trouble)

Substantial testing has been done with large real-world models (up to 8,000
Expand Down
33 changes: 18 additions & 15 deletions docs/source/modeling_with_aequilibrae/route_choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
Route Choice
============

As argued in the literature [3]_, the route choice problem does not have a closed solution, and the selection
of one of the many modelling frameworks [4]_ depends on many factors. A common modelling framework in practice
As argued in the literature [1]_, the route choice problem does not have a closed solution, and the selection
of one of the many modelling frameworks [2]_ depends on many factors. A common modelling framework in practice
is consists of two steps: Choice set generation and the choice selection process.

AequilibraE is the first modeling package with full support for route choice, from the creation of choice sets through
multiple algorithms to the assignment of trips to the network using the traditional Path-Size logit.

Costs, utilities and signs
~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------------------

AequilibraE's path computation procedures require all link costs to be positive. For that reason,
link utilities (or disutilities) must be positive, while its obvious minus sign is handled internally.
This mechanism prevents the possibility of links with actual positive utility, but those cases are arguably
not reasonable to exist in practice.

Choice set generation algorithms available
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------

All algorithms have been implemented as a single software class

Expand All @@ -29,7 +29,7 @@ All algorithms have been implemented as a single software class
| Link-Penalisation | Classical link penalisation. |
| | |
+----------------------------------+----------------------------------+
| Breadth-First Search with | As described in [4]_. |
| Breadth-First Search with | As described in [2]_. |
| Link Removal | |
+----------------------------------+----------------------------------+
| Breadth-First Search with | A combination of BFS-LE and LP |
Expand Down Expand Up @@ -65,24 +65,27 @@ Full process overview
---------------------

The estimation of route choice models based on vehicle GPS data can be explored on a family of papers scheduled to
be presented at the ATRF 2024 [1]_, [2]_, [3]_.
be presented at the ATRF 2024 [1]_ [3]_ [4]_.

.. [1] Zill, J. C., and P. V. de Camargo. State-Wide Route Choice Models (Submitted).
Presented at the ATRF, Melbourne, Australia, 2024.
.. [2] Rieser-Schüssler, N., Balmer, M., & Axhausen, K. W. (2012). Route choice sets for very high-resolution data.
Transportmetrica A: Transport Science, 9(9), 825–845.
https://doi.org/10.1080/18128602.2012.671383
.. [1] Camargo, P. V. de, and R. Imai. Map-Matching Large Streams of Vehicle GPS Data into Bespoke Networks (Submitted).
.. [3] Camargo, P. V. de, and R. Imai. Map-Matching Large Streams of Vehicle GPS Data into Bespoke Networks (Submitted).
Presented at the ATRF, Melbourne, 2024.
.. [2] Moss, J., P. V. de Camargo, C. de Freitas, and R. Imai. High-Performance Route Choice Set Generation on
.. [4] Moss, J., P. V. de Camargo, C. de Freitas, and R. Imai. High-Performance Route Choice Set Generation on
Large Networks (Submitted). Presented at the ATRF, Melbourne, 2024.
.. [3] Zill, J. C., and P. V. de Camargo. State-Wide Route Choice Models (Submitted).
Presented at the ATRF, Melbourne, Australia, 2024.
.. [4] Rieser-Schüssler, N., Balmer, M., & Axhausen, K. W. (2012). Route choice sets for very high-resolution data.
Transportmetrica A: Transport Science, 9(9), 825–845.
https://doi.org/10.1080/18128602.2012.671383
.. seealso::

LOREM IPSUM

.. toctree::
:maxdepth: 1

route_choice/route_choice_model.rst
route_choice/choice_set_generation.rst
route_choice/route_choice_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ development/estimation stage.
The overhead of the LP method is negligible due to AequilibraE's internal data structures that allow for easy
data manipulation of the graph in memory.


BFS-LE
~~~~~~

Expand Down Expand Up @@ -100,7 +99,6 @@ Code example
graph.prepare_graph(np.array([1, 2, 3, 50, 100, 150]))
nodes = [(1, 50), (2, 100), (3, 150)] # List of tuples with (origin, destination) nodes
max_routes = 10 # Maximum number of routes to be computed for each OD pair
penalty = 1.01 # Penalty to be applied to links used in paths.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Further, many AequilibraE users are new to the *craft*, so we have elected to st
creating documentation on the most important topics in the transportation modeling practice, where
we detail how these concepts are translated into the AequilibraE tools and recommended workflows.


.. toctree::
:maxdepth: 1
:caption: Static Traffic Assignment
Expand Down
10 changes: 4 additions & 6 deletions docs/source/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Support & Sponsors
Support
-------

AequilibraE is developed by a small but dedicated team of professionals with
limited funding.
AequilibraE is developed by a small but dedicated team of professionals with limited funding.

Free support
~~~~~~~~~~~~
Expand All @@ -19,7 +18,7 @@ already asked in the past, with the first option being the most often used as of

1. Joining the `AequilibraE Google Group <https://groups.google.com/forum/#!forum/aequilibrae>`_
and sending your question there.
2. Posting your question to `GIS StackOverflow <https://gis.stackexchange.com/>`_ using the #aequilibrae tag;
2. Posting your question to `GIS StackOverflow <https://gis.stackexchange.com/>`_ using the ``#aequilibrae`` tag;

Please note that all questions and answers in both forums are public.

Expand All @@ -29,7 +28,7 @@ Paid support
Paid support for AequilibraE is offered by Outer Loop Consulting, an Australia-based consulting company,
with support available in English, Portuguese, German & Spanish.

All support is offered in prepaid packages of a minimum of 10h of consulting by phone, email or Microsoft Teams
All support is offered in prepaid packages of a minimum of 10h of consulting by phone, e-mail or Microsoft Teams
at a fixed rate of USD 150/h.

To acquire a paid support package for AequilibraE, please e-mail [email protected]
Expand Down Expand Up @@ -66,8 +65,7 @@ Maintenance sponsors

2016:

* `Instituto de Pesquisa Econômica Aplicadas <https://www.ipea.gov.br>`_

* `Instituto de Pesquisa Econômica Aplicada <https://www.ipea.gov.br>`_

Feature sponsors
~~~~~~~~~~~~~~~~
Expand Down
14 changes: 7 additions & 7 deletions docs/source/validation_benchmarking/ipf_performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ we can take full advantage of multi-core CPUs. We have also implemented the abil
of using both 32-bit and 64-bit floating-point seed matrices, which has direct impact
on cache use and consequently computational performance.

In this section, we compare the
runtime of AequilibraE's current implementation of IPF,
with a general IPF algorithm written in pure Python, available `here <https://github.com/joshchea/python-tdm/blob/master/scripts/CalcDistribution.py>`_.
In this section, we compare the runtime of AequilibraE's current implementation of IPF,
with a general IPF algorithm written in pure Python, available
`here <https://github.com/joshchea/python-tdm/blob/master/scripts/CalcDistribution.py>`_.

The figure below compares AequilibraE's IPF runtime with one core with the benchmark Python
code. From the figure below, we can notice that the runtimes were practically the same for the
instances with 1,000 zones or less. As the number of zones increases, AequilibraE demonstrated to be slightly faster
than the benchmark python code, while applying IPF to a 32-bit NumPy array (np.float32) was significantly faster.
It's worth mentioning that
the user can set up a threshold for AequilibraE's IPF function, as well as use more than one
core to speed up the fitting process.
than the benchmark python code, while applying IPF to a 32-bit NumPy array (``np.float32``) was significantly faster.

It's worth mentioning that the user can set up a threshold for AequilibraE's IPF function,
as well as use more than one core to speed up the fitting process.

.. image:: ../images/ipf_runtime_aequilibrae_vs_benchmark.png
:align: center
Expand Down
Loading

0 comments on commit ae6f105

Please sign in to comment.