Skip to content

Commit

Permalink
Merge pull request #1177 from cvvergara/1153-optionB
Browse files Browse the repository at this point in the history
Fix #1153 with  Option B
  • Loading branch information
cvvergara authored Feb 25, 2019
2 parents af6ac53 + 3fee7c5 commit bf378c5
Show file tree
Hide file tree
Showing 64 changed files with 850 additions and 1,710 deletions.
6 changes: 3 additions & 3 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ file_filter = locale/<lang>/LC_MESSAGES/pgr_dijkstraCostMatrix.po
source_file = locale/pot/pgr_dijkstraCostMatrix.pot
source_lang = en

[pgrouting.pgr_eucledianTSP]
file_filter = locale/<lang>/LC_MESSAGES/pgr_eucledianTSP.po
source_file = locale/pot/pgr_eucledianTSP.pot
[pgrouting.pgr_euclideanTSP]
file_filter = locale/<lang>/LC_MESSAGES/pgr_euclideanTSP.po
source_file = locale/pot/pgr_euclideanTSP.pot
source_lang = en

[pgrouting.pgr_dijkstraCost]
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
pgRouting 3.0.0 Release Notes
-------------------------------------------------------------------------------

*Fixed Issues*

* [#1153 ](https://github.com/pgRouting/pgrouting/issues/1153)_: Renamed pgr_eucledianTSP to pgr_TSPeuclidean

*New Experimental functions*

* Prim family
Expand Down Expand Up @@ -97,6 +101,8 @@ pgRouting 3.0.0 Release Notes
* pgr_maxFlowEdmondsKarp
* pgr_maximumcardinalitymatching

* TSP old signatures




Expand Down
2 changes: 1 addition & 1 deletion doc/queries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SET(LOCAL_FILES
doc-pgr_nodeNetwork.queries
doc-pgr_analyzeOneWay.queries
doc-pgr_createVerticesTable.queries
doc-pgr_eucledianTSP.queries
doc-pgr_TSPeuclidean.queries
doc-pgr_TSP.queries
doc-pickDeliverEuclidean.queries
doc-contractGraph.queries
Expand Down
44 changes: 26 additions & 18 deletions doc/queries/doc-pgr_TSP.queries
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@ BEGIN
SET client_min_messages TO NOTICE;
SET
-- q1
WITH
query AS (
SELECT * FROM pgr_TSP(
$$
SELECT * FROM pgr_dijkstraCostMatrix(
'SELECT id, source, target, cost, reverse_cost FROM edge_table',
(SELECT array_agg(id) FROM edge_table_vertices_pgr WHERE id < 14),
directed := false
)
$$
)
)
SELECT agg_cost < 20 AS under_20 FROM query WHERE seq = 14;
under_20
----------
t
(1 row)
SELECT * FROM pgr_TSP(
$$
SELECT * FROM pgr_dijkstraCostMatrix(
'SELECT id, source, target, cost, reverse_cost FROM edge_table',
(SELECT array_agg(id) FROM edge_table_vertices_pgr WHERE id < 14),
directed := false)
$$,
randomize := false);
seq | node | cost | agg_cost
-----+------+------+----------
1 | 1 | 3 | 0
2 | 4 | 1 | 3
3 | 9 | 1 | 4
4 | 12 | 1 | 5
5 | 11 | 2 | 6
6 | 13 | 1 | 8
7 | 10 | 1 | 9
8 | 5 | 2 | 10
9 | 7 | 1 | 12
10 | 8 | 2 | 13
11 | 6 | 1 | 15
12 | 3 | 1 | 16
13 | 2 | 1 | 17
14 | 1 | 0 | 18
(14 rows)

-- q2
SELECT * FROM pgr_TSP(
Expand Down Expand Up @@ -57,7 +65,7 @@ SELECT * FROM pgr_TSP(
SELECT * FROM pgr_withPointsCostMatrix(
'SELECT id, source, target, cost, reverse_cost FROM edge_table ORDER BY id',
'SELECT pid, edge_id, fraction from pointsOfInterest',
array[-1, 3, 5, 6, -6], directed := false);
array[-1, 3, 5, 6, -6], directed := false)
$$,
start_id := 5,
randomize := false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,41 @@ BEGIN
SET client_min_messages TO NOTICE;
SET
-- q1
WITH
query AS (
SELECT * FROM pgr_eucledianTSP(
$$
SELECT id, st_X(the_geom) AS x, st_Y(the_geom)AS y FROM edge_table_vertices_pgr
$$
)
)
SELECT agg_cost < 20 AS under_20 FROM query WHERE seq = 18;
under_20
----------
t
(1 row)
SELECT * FROM pgr_TSPeuclidean(
$$
SELECT id, st_X(the_geom) AS x, st_Y(the_geom)AS y FROM edge_table_vertices_pgr
$$,
randomize := false);
seq | node | cost | agg_cost
-----+------+-------------------+------------------
1 | 1 | 1.4142135623731 | 0
2 | 3 | 1 | 1.4142135623731
3 | 4 | 1 | 2.41421356237309
4 | 9 | 1 | 3.41421356237309
5 | 6 | 0.58309518948453 | 4.41421356237309
6 | 16 | 0.860232526704263 | 4.99730875185763
7 | 12 | 1.11803398874989 | 5.85754127856189
8 | 17 | 1.11803398874989 | 6.97557526731178
9 | 11 | 1 | 8.09360925606168
10 | 10 | 0.5 | 9.09360925606168
11 | 15 | 0.5 | 9.59360925606168
12 | 13 | 1.58113883008419 | 10.0936092560617
13 | 14 | 1.58113883008419 | 11.6747480861459
14 | 7 | 1 | 13.2558869162301
15 | 8 | 1 | 14.2558869162301
16 | 5 | 1 | 15.2558869162301
17 | 2 | 1 | 16.2558869162301
18 | 1 | 0 | 17.2558869162301
(18 rows)

-- q2
SELECT* from pgr_eucledianTSP(
SELECT* from pgr_TSPeuclidean(
$$
SELECT id, st_X(the_geom) AS x, st_Y(the_geom) AS y FROM edge_table_vertices_pgr
$$,
tries_per_temperature := 3,
cooling_factor := 0.5,
randomize := false
);
randomize := false);
seq | node | cost | agg_cost
-----+------+------------------+------------------
1 | 1 | 1.4142135623731 | 0
Expand All @@ -51,14 +63,13 @@ SELECT* from pgr_eucledianTSP(
-- q3
SET client_min_messages TO DEBUG1;
SET
SELECT* from pgr_eucledianTSP(
SELECT* from pgr_TSPeuclidean(
$$
SELECT id, st_X(the_geom) AS x, st_Y(the_geom) AS y FROM edge_table_vertices_pgr
$$,
tries_per_temperature := 0,
randomize := false
);
DEBUG: pgr_eucledianTSP Processing Information
randomize := false);
DEBUG: Processing Information
Initializing tsp class ---> tsp.greedyInitial ---> tsp.annealing ---> OK

Cycle(100) total changes =0 0 were because delta energy < 0
Expand Down
2 changes: 1 addition & 1 deletion doc/src/pgRouting-concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ Description of the return values for a :doc:`costMatrix-category` function

.. return_cost_start

Returns set of ``(start_vid, end_vid, agg_cost)``
Returns SET OF ``(start_vid, end_vid, agg_cost)``

============== ========== =================================================
Column Type Description
Expand Down
Loading

0 comments on commit bf378c5

Please sign in to comment.