-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pgtap] Using sampledata on 4 directories
* astar * empty_combinations_empty_result.pg => empty_inner_queries_empty_result.pg * new test: compare_dijkstra/combinations.pg * dijkstra * deleted remaining_tests.pg that has duplicated tests * deleted issue_1152.pg that takes too long n time and resources and is not unit test * ksp * withPoints * new tests: allowed_driving_side.pg
- Loading branch information
Showing
96 changed files
with
1,552 additions
and
2,494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/*PGR-GNU***************************************************************** | ||
|
||
Copyright (c) 2023 pgRouting developers | ||
Mail: [email protected] | ||
|
||
------ | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
********************************************************************PGR-GNU*/ | ||
|
||
BEGIN; | ||
|
||
SELECT CASE WHEN min_version('3.2.0') THEN plan(4) ELSE plan(1) END; | ||
|
||
UPDATE edges SET cost = sign(cost) + 0.001 * id * id, reverse_cost = sign(reverse_cost) + 0.001 * id * id; | ||
|
||
CREATE or REPLACE FUNCTION astarCompareDijkstra(cant INTEGER default 17) | ||
RETURNS SETOF TEXT AS | ||
$BODY$ | ||
DECLARE | ||
inner_sql TEXT; | ||
dijkstra_sql TEXT; | ||
astar_sql TEXT; | ||
vids TEXT; | ||
data TEXT; | ||
BEGIN | ||
IF NOT min_version('3.2.0') THEN | ||
RETURN query | ||
SELECT skip(1, 'Combinations signature added on version 3.2'); | ||
RETURN; | ||
END IF; | ||
|
||
data := ' path_seq, start_vid, end_vid, round(cost::numeric,8) AS cost, round(agg_cost::numeric,8) AS agg_cost '; | ||
vids := ' SELECT * FROM combinations '; | ||
|
||
|
||
----------------------- | ||
-- with reverse cost | ||
----------------------- | ||
inner_sql := 'SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edges'; | ||
-- DIRECTED | ||
dijkstra_sql := 'SELECT ' || data || ' FROM pgr_dijkstra($$' || inner_sql || '$$, $$' || vids || '$$, true)'; | ||
astar_sql := 'SELECT ' || data || ' FROM pgr_astar($$' || inner_sql || '$$, $$' || vids || '$$, true, heuristic := 0)'; | ||
RETURN query SELECT set_eq(astar_sql, dijkstra_sql, astar_sql); | ||
|
||
-- UNDIRECTED | ||
dijkstra_sql := 'SELECT ' || data || ' FROM pgr_dijkstra($$' || inner_sql || '$$, $$' || vids || '$$, false)'; | ||
astar_sql := 'SELECT ' || data || ' FROM pgr_astar($$' || inner_sql || '$$, $$' || vids || '$$, false, heuristic := 0)'; | ||
RETURN query SELECT set_eq(astar_sql, dijkstra_sql, astar_sql); | ||
|
||
----------------------- | ||
-- NO reverse cost | ||
----------------------- | ||
-- DIRECTED | ||
inner_sql := 'SELECT id, source, target, cost, x1, y1, x2, y2 FROM edges'; | ||
dijkstra_sql := 'SELECT ' || data || ' FROM pgr_dijkstra($$' || inner_sql || '$$, $$' || vids || '$$, true)'; | ||
astar_sql := 'SELECT ' || data || ' FROM pgr_astar($$' || inner_sql || '$$, $$' || vids || '$$, true, heuristic := 0)'; | ||
RETURN query SELECT set_eq(astar_sql, dijkstra_sql, astar_sql); | ||
|
||
-- UNDIRECTED | ||
dijkstra_sql := 'SELECT ' || data || ' FROM pgr_dijkstra($$' || inner_sql || '$$, $$' || vids || '$$, false)'; | ||
astar_sql := 'SELECT ' || data || ' FROM pgr_astar($$' || inner_sql || '$$, $$' || vids || '$$, false, heuristic := 0)'; | ||
RETURN query SELECT set_eq(astar_sql, dijkstra_sql, astar_sql); | ||
|
||
RETURN; | ||
END | ||
$BODY$ | ||
language plpgsql; | ||
|
||
SELECT * from astarCompareDijkstra(); | ||
|
||
|
||
SELECT * FROM finish(); | ||
ROLLBACK; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
pgtap/astar/astar/edge_cases/empty_combinations_empty_result.pg
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.