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

New pgr trsp via with points #2257

Merged
merged 14 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: |
mkdir build
cd build
cmake -DPOSTGRESQL_BIN=${{ env.POSTGRESQL_DIR }}\bin -DPOSTGRESQL_INCLUDE_DIR="${{ env.POSTGRESQL_DIR }}\include;${{ env.POSTGRESQL_DIR }}\include\server" -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DWITH_DOC=OFF ..
cmake -DPOSTGRESQL_BIN=${{ env.POSTGRESQL_DIR }}\bin -DPOSTGRESQL_INCLUDE_DIR="${{ env.POSTGRESQL_DIR }}\include;${{ env.POSTGRESQL_DIR }}\include\server" -G"Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DWITH_DOC=OFF ..
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

Expand Down
8 changes: 5 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ pgRouting 3.4.0 Release Notes

* Turn Restrictions

* ``pgr_trspVia``
* Via with turn restrictions

* ``pgr_trspVia`` (One Via)
* ``pgr_trspVia_withPoints`` (One Via)

* ``pgr_trsp``

Expand All @@ -33,9 +34,10 @@ pgRouting 3.4.0 Release Notes

* Turn Restrictions

* ``pgr_trsp(text, integer, integer, boolean, boolean, text)``
* ``pgr_trsp(text, integer, float8, integer, float8, boolean, boolean, text)``
* ``pgr_trsp(text,integer,integer,boolean,boolean,text)``
* ``pgr_trsp(text,integer,float8,integer,float8,boolean,boolean,text)``
* ``pgr_trspViaVertices(text,anyarray,boolean,boolean,text)``
* ``pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text)``



Expand Down
8 changes: 4 additions & 4 deletions doc/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx.ext.graphviz',
'sphinx.ext.autosectionlabel',
]
autosectionlabel_prefix_document = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down Expand Up @@ -318,10 +320,8 @@ linkcheck_ignore = [
'https://docs.pgrouting.org/latest/en/pgr_trspVia.html',
'https://docs.pgrouting.org/latest/en/pgr_withPointsVia.html',
'https://docs.pgrouting.org/latest/en/via-category.html',
'https://docs.pgrouting.org/3.4/en/pgr_withPointsVia.html',
'https://docs.pgrouting.org/3.4/en/via-category.html',


'https://docs.pgrouting.org/latest/en/pgr_trspVia_withPoints.html',
'https://docs.pgrouting.org/3.4/en/pgr_trspVia_withPoints.html',

# FIXME: tmp disable due to Retry-After header for rate-limiting by Github not respected
# (see: https://github.com/sphinx-doc/sphinx/issues/7388)
Expand Down
1 change: 1 addition & 0 deletions doc/images/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SET(LOCAL_FILES
test1.png
trsp-test-image.png
with_restrictions.png
restrictions.png
)

foreach (f ${LOCAL_FILES})
Expand Down
Binary file added doc/images/restrictions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion doc/pickDeliver/VRP-category.rst
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,12 @@ Results
OUT service_time FLOAT,
OUT departure_time FLOAT

.. _return_vrp_matrix_start:

Description of the result (TODO Disussion: Euclidean & Matrix)
.........................................................................................

.. _return_vrp_matrix_start:

.. todo:: fix when everything below is fixed


Expand Down
14 changes: 7 additions & 7 deletions doc/src/pgRouting-introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,23 @@ Contributors
This Release Contributors
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Individuals (in alphabetical order)
Individuals in this release (in alphabetical order)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Ashish Kumar,
Cayetano Benavent,
Daniel Kastl,
Himanshu Raj,
Martha Vergara,
Rajat Shinde,
Regina Obe,
Veenit Kumar,
Swapnil Joshi,
Virginia Vergara


And all the people that give us a little of their time making comments, finding issues, making pull requests etc.
in any of our products: osm2pgrouting, pgRouting, pgRoutingLayer.
in any of our products: osm2pgrouting, pgRouting, pgRoutingLayer, workshop.


Corporate Sponsors (in alphabetical order)
Corporate Sponsors in this release (in alphabetical order)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

These are corporate entities that have contributed developer time, hosting, or direct monetary funding to the pgRouting project:
Expand Down Expand Up @@ -117,9 +116,10 @@ Jay Mahadeokar, Jinfu Leng,
Kai Behncke, Kishore Kumar, Ko Nagase,
Mahmoud Sakr,
Manikata Kondeti, Mario Basa, Martin Wiesenhaan, Maxim Dubinin, Maoguang Wang, Mohamed Bakli, Mohamed Zia, Mukul Priya,
Rajat Shinde,
Razequl Islam,
Regina Obe, Rohith Reddy,
Sarthak Agarwal, Sourabh Garg, Stephen Woodbridge, Sylvain Housseman, Sylvain Pasche,
Sarthak Agarwal, Sourabh Garg, Stephen Woodbridge, Swapnil Joshi, Sylvain Housseman, Sylvain Pasche,
Veenit Kumar, Vidhan Jain, Virginia Vergara

Corporate Sponsors (in alphabetical order)
Expand Down
1 change: 1 addition & 0 deletions doc/src/proposed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Proposed Functions

withPoints-family
KSP-category
via-category

See Also
-------------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ pgRouting 3.4.0 Release Notes

* Turn Restrictions

* ``pgr_trspVia``
* Via with turn restrictions

* ``pgr_trspVia`` (One Via)
* ``pgr_trspVia_withPoints`` (One Via)

* ``pgr_trsp``

Expand All @@ -69,9 +70,10 @@ pgRouting 3.4.0 Release Notes

* Turn Restrictions

* ``pgr_trsp(text, integer, integer, boolean, boolean, text)``
* ``pgr_trsp(text, integer, float8, integer, float8, boolean, boolean, text)``
* ``pgr_trsp(text,integer,integer,boolean,boolean,text)``
* ``pgr_trsp(text,integer,float8,integer,float8,boolean,boolean,text)``
* ``pgr_trspViaVertices(text,anyarray,boolean,boolean,text)``
* ``pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text)``



Expand Down
7 changes: 0 additions & 7 deletions doc/src/routingFunctions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ Functions by categories
:start-after: index from here
:end-before: index to here

:doc:`via-category`

.. include:: via-category.rst
:start-after: from here
:end-before: to here

.. to-here

.. toctree::
Expand Down Expand Up @@ -175,7 +169,6 @@ Functions by categories
costMatrix-category
drivingDistance-category
spanningTree-family
via-category

See Also
-------------------------------------------------------------------------------
Expand Down
11 changes: 3 additions & 8 deletions doc/src/via-category.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
Via - Category
===============================================================================

.. from here

* :doc:`pgr_dijkstraVia`

.. to here


.. rubric:: proposed

.. include:: proposed.rst
Expand All @@ -31,8 +24,10 @@ Via - Category

.. proposed start

* :doc:`pgr_trspVia`
* :doc:`pgr_dijkstraVia`
* :doc:`pgr_withPointsVia`
* :doc:`pgr_trspVia`
* :doc:`pgr_trspVia_withPoints`

.. proposed end

Expand Down
1 change: 1 addition & 0 deletions doc/trsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SET(LOCAL_FILES
TRSP-family.rst
pgr_trsp.rst
pgr_trspVia.rst
pgr_trspVia_withPoints.rst
pgr_trsp_withPoints.rst
pgr_turnRestrictedPath.rst
)
Expand Down
39 changes: 34 additions & 5 deletions doc/trsp/TRSP-family.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ When points are also given as input:

- :doc:`pgr_trsp` - Vertex - Vertex routing with restrictions.
- :doc:`pgr_trspVia` - Via Vertices routing with restrictions.
- :doc:`pgr_trsp_withPoints` - Vertex/Point - Vertex/Point routing with restrictions.
- :doc:`pgr_trsp_withPoints` - Vertex/Point - Vertex/Point routing with
restrictions.
- :doc:`pgr_trspVia_withPoints` - Via Vertices/point routing with restrictions.

.. index proposed to here

Expand All @@ -50,18 +52,41 @@ When points are also given as input:
pgr_trsp
pgr_trspVia
pgr_trsp_withPoints
pgr_trspVia_withPoints
pgr_turnRestrictedPath

Introduction
-------------------------------------------------------------------------------

Road restrictions are a sequence of road segments that can not be taken in a
sequential manner.
Some restrictions are implicit on a directed graph, for example, one way roads
where the wrong way edge is not even inserted on the graph.
But normally on turns like **left turn** or **right turn**, hence the name turn
restrictions, there are sometimes restrictions.

.. image:: images/restrictions.png


|

TRSP algorithm
...............................................................................

The internal TRSP algorithm performs a lookahead over the dijkstra algorithm in
order to find out if the attempted path has a restriction. This allows the
algorithm to pass twice on the same vertex.

|

Restrictions
...............................................................................

On road networks, there are restrictions such as left or right turn restrictions,
no U turn restrictions.

A restriction is a sequence of edges, called **path** and that **path** is to be avoided.
A restriction is a sequence of edges, called **path** and that **path** is to be
avoided.

.. figure:: /images/with_restrictions.png
:scale: 50%
Expand All @@ -74,8 +99,11 @@ These restrictions are represented on a table as follows:
:start-after: --RESTRICTIONS CREATE start
:end-before: --RESTRICTIONS CREATE end

.. note:: The table has an identifier, which maybe is needed for the administration of the restrictions, but the
algorithms do not need that information. If given it will be ignored.
.. note:: The table has an identifier, which maybe is needed for the
administration of the restrictions, but the algorithms do not need that
information. If given it will be ignored.

|

Restrictions SQL
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand All @@ -92,7 +120,8 @@ Restrictions SQL
- Description
* - ``path``
- ``ARRAY[`` **ANY-INTEGER** ``]``
- Sequence of edge identifiers that form a path that is not allowed to be taken.
- Sequence of edge identifiers that form a path that is not allowed to be
taken.
- Empty arrays or ``NULL`` arrays are ignored.
- Arrays that have a ``NULL`` element will raise an exception.
* - ``Cost``
Expand Down
30 changes: 13 additions & 17 deletions doc/trsp/pgr_trsp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pgr_trsp - Proposed
===============================================================================


``pgr_trsp`` Vertex - Vertex routing with restrictions.
``pgr_trsp`` - routing vertices with restrictions.

.. rubric:: Availability

Expand All @@ -45,6 +45,7 @@ pgr_trsp - Proposed
* Signature ``pgr_trsp(text,integer,integer,boolean,boolean,text)`` is deprecated
* Signature ``pgr_trsp(text,integer,float,integer,float,boolean,boolean,text)`` is deprecated
* Signature ``pgr_trspViaVertices(text,anyarray,boolean,boolean,text)`` is deprecated
* Signature ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)`` is deprecated

* Version 2.1.0

Expand Down Expand Up @@ -79,7 +80,7 @@ The general algorithm is as follows:
* Execute a Dijkstra
* If the solution passes thru a restriction then

* Execute the TRSP algorithm with restrictions
* Execute the **TRSP** algorithm with restrictions



Expand All @@ -106,14 +107,6 @@ Signatures
OR EMPTY SET


.. rubric:: Prototype

.. code-block:: none

pgr_trspViaEdges(sql text, eids integer[], pcts float8[],
directed boolean, has_rcost boolean [, turn_restrict_sql text]) -- Prototype on v2.1
RETURNS SETOF (seq, id1, id2, id3, cost)

.. rubric:: Deprecated

.. code-block:: none
Expand All @@ -126,6 +119,8 @@ Signatures

pgr_trspViaVertices(sql text, vids integer[],
directed boolean, has_rcost boolean [, restrictions_sql text]) -- Deprecated on v3.4
pgr_trspViaEdges(sql text, eids integer[], pcts float8[],
directed boolean, has_rcost boolean [, restrictions_sql text]) -- Deprecated on v3.4
RETURNS SETOF (seq, id1, id2, id3, cost)

.. index::
Expand Down Expand Up @@ -490,8 +485,8 @@ The following signature is substituted with :doc:`pgr_dijkstra` when there are n



Different ways to represent `no path found`
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Different ways to represent `no path found` on ``pgr_trsp`` (**vertices**)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

* Sometimes represents with **EMPTY SET** a no path found
* Sometimes represents with **EXCEPTION** a no path found
Expand Down Expand Up @@ -538,7 +533,7 @@ When there are restrictions the proposed ``pgr_trsp`` (`One to One`_) should be
:start-after: --place8
:end-before: --place9

User contradictions
User contradictions ``pgr_trsp`` (**vertices**)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

``pgr_trsp`` unlike other pgRouting functions does not autodetect the existence of ``reverse_cost`` column. Therefore it
Expand Down Expand Up @@ -588,7 +583,7 @@ The "Edges" signature version
target_edge integer, target_pos float8,
directed boolean, has_rcost boolean [,restrict_sql text]);

Different ways to represent `no path found`
Different ways to represent `no path found ``pgr_trsp`` (**edges**)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

* Sometimes represents with **EMPTY SET** a no path found
Expand Down Expand Up @@ -691,11 +686,12 @@ When there are restrictions :doc:`pgr_trsp_withPoints` (One to One) should be us
:start-after: --place16.2
:end-before: --place17

User contradictions
User contradictions ``pgr_trsp`` (**edges**)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

``pgr_trsp`` unlike other pgRouting functions does not autodetect the existence of ``reverse_cost`` column. Therefore it
has ``has_rcost`` parameter to check the existence of ``reverse_cost`` column. Contradictions happen:
``pgr_trsp`` unlike other pgRouting functions does not autodetect the existence
of ``reverse_cost`` column. Therefore it has ``has_rcost`` parameter to check
the existence of ``reverse_cost`` column. Contradictions happen:

- When the ``reverse_cost`` is missing, and the flag ``has_rcost`` is set to true
- When the ``reverse_cost`` exists, and the flag ``has_rcost`` is set to false
Expand Down
2 changes: 1 addition & 1 deletion doc/trsp/pgr_trspVia.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The general algorithm is as follows:
* Execute a :doc:`pgr_dijkstraVia`.
* For the set of sub paths of the solution that pass through a restriction then

* Execute the :doc:`pgr_trsp` algorithm with restrictions for the sub paths.
* Execute the **TRSP** algorithm with restrictions for the paths.
* **NOTE** when this is done, ``U_turn_on_edge`` flag is ignored.


Expand Down
Loading