Skip to content
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: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pgRouting 3.2.0 Release Notes

*New proposed functions*

* pgr_aStar(Combinations)
* pgr_aStarCost(Combinations)
* pgr_withPoints(Combinations)
* pgr_withPointsCost(Combinations)

Expand Down
93 changes: 64 additions & 29 deletions doc/astar/pgr_aStar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ pgr_aStar

.. rubric:: Availability

* Version 3.2.0

* New **proposed** function:

* pgr_aStar(Combinations)

* Version 3.0.0

* **Official** function
Expand All @@ -44,7 +50,8 @@ pgr_aStar
.. rubric:: Support

* **Supported versions:**
current(`3.1 <https://docs.pgrouting.org/3.1/en/pgr_aStar.html>`__)
current(`3.2 <https://docs.pgrouting.org/3.2/en/pgr_aStar.html>`__)
`3.1 <https://docs.pgrouting.org/3.1/en/pgr_aStar.html>`__
`3.0 <https://docs.pgrouting.org/3.0/en/pgr_aStar.html>`__
`2.6 <https://docs.pgrouting.org/2.6/en/pgr_aStar.html>`__

Expand Down Expand Up @@ -80,10 +87,11 @@ Signatures

.. code-block:: none

pgr_aStar(edges_sql, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(edges_sql, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(edges_sql, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(edges_sql, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, Combinations SQL [, directed] [, heuristic] [, factor] [, epsilon]) -- Proposed on v3.2

RETURNS SET OF (seq, path_seq [, start_vid] [, end_vid], node, edge, cost, agg_cost)
OR EMPTY SET
Expand All @@ -94,7 +102,7 @@ Optional parameters are `named parameters` and have a default value.

.. code-block:: none

pgr_aStar(edges_sql, from_vid, to_vid)
pgr_aStar(Edges SQL, from_vid, to_vid)
RETURNS SET OF (seq, path_seq, node, edge, cost, agg_cost)
OR EMPTY SET

Expand All @@ -112,7 +120,7 @@ One to One

.. code-block:: none

pgr_aStar(edges_sql, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])

RETURNS SET OF (seq, path_seq, node, edge, cost, agg_cost)
OR EMPTY SET
Expand All @@ -131,7 +139,7 @@ One to many

.. code-block:: none

pgr_aStar(edges_sql, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (seq, path_seq, end_vid, node, edge, cost, agg_cost)
OR EMPTY SET

Expand All @@ -149,7 +157,7 @@ Many to One

.. code-block:: none

pgr_aStar(edges_sql, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (seq, path_seq, start_vid, node, edge, cost, agg_cost)
OR EMPTY SET

Expand All @@ -167,7 +175,7 @@ Many to Many

.. code-block:: none

pgr_aStar(edges_sql, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStar(Edges SQL, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)
OR EMPTY SET

Expand All @@ -177,36 +185,56 @@ Many to Many
:start-after: --q5
:end-before: --q6

.. index::
single: aStar(Combinations) - Proposed

Combinations
...............................................................................

.. code-block:: none

pgr_aStar(Edges SQL, Combinations SQL [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)
OR EMPTY SET

:Example: Using a combinations table on a **directed** graph using heuristic :math:`2`.


.. literalinclude:: doc-astar.queries
:start-after: --q6
:end-before: --q7

Parameters
-------------------------------------------------------------------------------

.. aStar parameters start

================ ====================== =================================================
Parameter Type Description
================ ====================== =================================================
**edges_sql** ``TEXT`` `edges_sql`_ inner query.
**from_vid** ``ANY-INTEGER`` Starting vertex identifier. Parameter in:
======================= ====================== =================================================
Parameter Type Description
======================= ====================== =================================================
**Edges SQL** ``TEXT`` `Edges query` as described below.
**Combinations SQL** ``TEXT`` `Combinations query` as described below.
**from_vid** ``ANY-INTEGER`` Starting vertex identifier. Parameter in:

* `One to One`_
* `One to Many`_
* `One to One`_
* `One to Many`_

**from_vids** ``ARRAY[ANY-INTEGER]`` Array of starting vertices identifiers. Parameter in:
**from_vids** ``ARRAY[ANY-INTEGER]`` Array of starting vertices identifiers. Parameter in:

* `Many to One`_
* `Many to Many`_
* `Many to One`_
* `Many to Many`_

**to_vid** ``ANY-INTEGER`` Ending vertex identifier. Parameter in:
**to_vid** ``ANY-INTEGER`` Ending vertex identifier. Parameter in:

* `One to One`_
* `Many to One`_
* `One to One`_
* `Many to One`_

**to_vids** ``ARRAY[ANY-INTEGER]`` Array of ending vertices identifiers. Parameter in:
**to_vids** ``ARRAY[ANY-INTEGER]`` Array of ending vertices identifiers. Parameter in:

* `One to Many`_
* `Many to Many`_
* `One to Many`_
* `Many to Many`_

================ ====================== =================================================
======================= ====================== =================================================

.. aStar parameters end

Expand Down Expand Up @@ -236,16 +264,23 @@ Parameter Type Default Description

.. aStar optional parameters end

Inner query
Inner queries
-------------------------------------------------------------------------------

edges_sql
Edges query
...............................................................................

.. include:: pgRouting-concepts.rst
:start-after: xy_edges_sql_start
:end-before: xy_edges_sql_end

Combinations query
...............................................................................

.. include:: pgRouting-concepts.rst
:start-after: basic_combinations_sql_start
:end-before: basic_combinations_sql_end

Result Columns
-------------------------------------------------------------------------------

Expand Down
58 changes: 46 additions & 12 deletions doc/astar/pgr_aStarCost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ pgr_aStarCost

.. rubric:: Availability

* Version 3.2.0

* New **proposed** function:

* pgr_aStarCost(Combinations)

* Version 3.0.0

* **Official** function
Expand All @@ -30,7 +36,8 @@ pgr_aStarCost
.. rubric:: Support

* **Supported versions:**
current(`3.1 <https://docs.pgrouting.org/3.1/en/pgr_aStarCost.html>`__)
current(`3.2 <https://docs.pgrouting.org/3.2/en/pgr_aStarCost.html>`__)
`3.1 <https://docs.pgrouting.org/3.1/en/pgr_aStarCost.html>`__
`3.0 <https://docs.pgrouting.org/3.0/en/pgr_aStarCost.html>`__
`2.6 <https://docs.pgrouting.org/2.6/en/pgr_aStarCost.html>`__

Expand Down Expand Up @@ -60,10 +67,11 @@ Signatures

.. code-block:: none

pgr_aStarCost(edges_sql, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(edges_sql, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(edges_sql, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(edges_sql, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, Combinations SQL [, directed] [, heuristic] [, factor] [, epsilon]) -- Proposed on v3.2

RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET
Expand All @@ -74,7 +82,7 @@ Optional parameters are `named parameters` and have a default value.

.. code-block:: none

pgr_aStarCost(edges_sql, start_vid, end_vid)
pgr_aStarCost(Edges SQL, start_vid, end_vid)
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

Expand All @@ -92,7 +100,7 @@ One to One

.. code-block:: none

pgr_aStarCost(edges_sql, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vid, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

Expand All @@ -110,7 +118,7 @@ One to many

.. code-block:: none

pgr_aStarCost(edges_sql, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vid, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

Expand All @@ -128,7 +136,7 @@ Many to One

.. code-block:: none

pgr_aStarCost(edges_sql, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vids, to_vid [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

Expand All @@ -146,7 +154,7 @@ Many to Many

.. code-block:: none

pgr_aStarCost(edges_sql, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
pgr_aStarCost(Edges SQL, from_vids, to_vids [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

Expand All @@ -156,6 +164,25 @@ Many to Many
:start-after: --q5
:end-before: --q6

.. index::
single: aStarCost(Combinations) - Proposed

Combinations
...............................................................................

.. code-block:: none

pgr_aStarCost(Edges SQL, Combinations SQL [, directed] [, heuristic] [, factor] [, epsilon])
RETURNS SET OF (start_vid, end_vid, agg_cost)
OR EMPTY SET

:Example: Using a combinations table on a **directed** graph using heuristic :math:`2`.


.. literalinclude:: doc-aStarCost.queries
:start-after: --q6
:end-before: --q7

Parameters
-------------------------------------------------------------------------------

Expand All @@ -170,16 +197,23 @@ Optional Parameters
:start-after: aStar optional parameters start
:end-before: aStar optional parameters end

Inner query
Inner queries
-------------------------------------------------------------------------------

edges_sql
Edges query
...............................................................................

.. include:: pgRouting-concepts.rst
:start-after: xy_edges_sql_start
:end-before: xy_edges_sql_end

Combinations query
...............................................................................

.. include:: pgRouting-concepts.rst
:start-after: basic_combinations_sql_start
:end-before: basic_combinations_sql_end

Result Columns
--------------------------------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ pgRouting 3.2.0 Release Notes

.. rubric:: New proposed functions

* pgr_aStar(Combinations)
* pgr_aStarCost(Combinations)
* pgr_withPoints(Combinations)
* pgr_withPointsCost(Combinations)

Expand Down
11 changes: 11 additions & 0 deletions docqueries/astar/doc-aStarCost.result
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,16 @@ SELECT * FROM pgr_aStarCost(
(4 rows)

--q6
SELECT * FROM pgr_aStarCost(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
'SELECT * FROM ( VALUES (7, 3), (2, 12) ) AS t(source, target)',
heuristic := 2);
start_vid | end_vid | agg_cost
-----------+---------+----------
2 | 12 | 4
7 | 3 | 6
(2 rows)

--q7
ROLLBACK;
ROLLBACK
5 changes: 5 additions & 0 deletions docqueries/astar/doc-aStarCost.test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ SELECT * FROM pgr_aStarCost(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
ARRAY[7, 2], ARRAY[3, 12], heuristic := 2);
\echo --q6
SELECT * FROM pgr_aStarCost(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
'SELECT * FROM ( VALUES (7, 3), (2, 12) ) AS t(source, target)',
heuristic := 2);
\echo --q7
21 changes: 21 additions & 0 deletions docqueries/astar/doc-astar.result
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,26 @@ SELECT * FROM pgr_astar(
(24 rows)

--q6
SELECT * FROM pgr_astar(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
'SELECT * FROM ( VALUES (7, 3), (2, 12) ) AS t(source, target)',
heuristic := 2);
seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
-----+----------+-----------+---------+------+------+------+----------
1 | 1 | 2 | 12 | 2 | 4 | 1 | 0
2 | 2 | 2 | 12 | 5 | 10 | 1 | 1
3 | 3 | 2 | 12 | 10 | 12 | 1 | 2
4 | 4 | 2 | 12 | 11 | 13 | 1 | 3
5 | 5 | 2 | 12 | 12 | -1 | 0 | 4
6 | 1 | 7 | 3 | 7 | 6 | 1 | 0
7 | 2 | 7 | 3 | 8 | 7 | 1 | 1
8 | 3 | 7 | 3 | 5 | 8 | 1 | 2
9 | 4 | 7 | 3 | 6 | 9 | 1 | 3
10 | 5 | 7 | 3 | 9 | 16 | 1 | 4
11 | 6 | 7 | 3 | 4 | 3 | 1 | 5
12 | 7 | 7 | 3 | 3 | -1 | 0 | 6
(12 rows)

--q7
ROLLBACK;
ROLLBACK
5 changes: 5 additions & 0 deletions docqueries/astar/doc-astar.test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ SELECT * FROM pgr_astar(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
ARRAY[7, 2], ARRAY[3, 12], heuristic := 2);
\echo --q6
SELECT * FROM pgr_astar(
'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edge_table',
'SELECT * FROM ( VALUES (7, 3), (2, 12) ) AS t(source, target)',
heuristic := 2);
\echo --q7
Loading