Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b5895a8
Generated template code
vidhan13j07 May 29, 2017
f2af36f
boost version updated by itself
vidhan13j07 May 29, 2017
146adbc
Fixed input for additional TEXT column
vidhan13j07 May 29, 2017
7fe6fec
fixed index errors
vidhan13j07 May 29, 2017
fccac7c
Fixing process
vidhan13j07 May 29, 2017
e8f0d84
Fixed documentation test
vidhan13j07 May 29, 2017
3510489
Added pgtap testing support
vidhan13j07 May 31, 2017
e45eaaf
travis not fixed
vidhan13j07 May 31, 2017
89e501a
fixed typescheck
vidhan13j07 May 31, 2017
695ac5c
removed unwanted comments
vidhan13j07 May 31, 2017
1d695d3
Added todos
vidhan13j07 Jun 1, 2017
445536e
Added two edge test
vidhan13j07 Jun 2, 2017
d33ba26
removed comma from conf file
vidhan13j07 Jun 2, 2017
f3193d3
Added sample cases in two edge test
vidhan13j07 Jun 2, 2017
25461e7
Added edges 4 and 7 only in two edge test
vidhan13j07 Jun 2, 2017
5e7655b
Added tests
vidhan13j07 Jun 2, 2017
263ebf4
Changed restrictions_table to restrictions
vidhan13j07 Jun 2, 2017
e1bc81e
Extend tests
vidhan13j07 Jun 2, 2017
f6f5c43
Add condition on restrictions table
vidhan13j07 Jun 2, 2017
8e5c0b3
Added 4 more tests
vidhan13j07 Jun 2, 2017
463d5bd
Add result file and fix travis
vidhan13j07 Jun 2, 2017
e7867a0
Added empty_set.test.sql
vidhan13j07 Jun 2, 2017
4e5ac2c
Added pgtap integration to empty_set.test.sql
vidhan13j07 Jun 2, 2017
0aaaf3f
Fixed file location
vidhan13j07 Jun 2, 2017
65e23ba
fix travis
vidhan13j07 Jun 2, 2017
857cafa
fixed some filenames
vidhan13j07 Jun 2, 2017
e8a8e3d
fixed small bugs
vidhan13j07 Jun 2, 2017
4b22723
remove comments
vidhan13j07 Jun 2, 2017
c7bd0bf
removed extra line from pgtap_design.test.sql
vidhan13j07 Jun 2, 2017
d05355b
Added more tests
vidhan13j07 Jun 3, 2017
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ build
fix_typos
code_linter

tools/template/mycreate.sh
*.sh
.DS_Store
.vagrant
tools/vagrant/packaging.sh
Expand Down
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------------
# Travis CI scripts
# Travis CI scripts
# Copyright(c) pgRouting Contributors
#
# Main configuration
Expand All @@ -8,7 +8,7 @@
#choose trusty

group: edge
dist: trusty
dist: trusty
sudo: required


Expand Down Expand Up @@ -70,12 +70,11 @@ before_script:
- ./tools/travis/check-extensions.sh $POSTGRESQL_VERSION ___pgr___test___


script:
script:
- ./tools/travis/pgrouting_build.sh $POSTGRESQL_VERSION $POSTGIS_VERSION
# tests as part of script so if a test fails the build fails
- ./tools/testers/pg_prove_tests.sh $PG_USER DEBUG

after_script:
#after_script:
- ./tools/travis/pgrouting_test.sh $POSTGRESQL_VERSION $PG_USER -ignorenotice

#after_success:
Expand Down
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ set(PgRouting_SOURCE_NAMES
"common"

#----------------------
# "dijkstra" can not be removed
# "dijkstra" can not be removed
# Has the command needed to link with prostgresl
#----------------------
"dijkstra" #2.1
Expand Down Expand Up @@ -105,9 +105,11 @@ set(PgRouting_SOURCE_NAMES
"max_flow" # 2.3
"contraction" # 2.3
"pickDeliver" # 2.3
"vrp_basic" # 2.0
"vrp_basic" # 2.0
"withPoints" # 2.2

"dijkstraTRSP"

# template generated name
#"funnyDijkstra"

Expand All @@ -118,7 +120,7 @@ set(PgRouting_SOURCE_NAMES
#
# - <directory>/sql/CMakeLists.txt must exist
#-----------------------------------------------------------------------------
set(PgRouting_SQL_DIRECTORIES
set(PgRouting_SQL_DIRECTORIES

"topology" # needs to be revised

Expand All @@ -130,7 +132,7 @@ set(PgRouting_SQL_DIRECTORIES
"costMatrix" # proposed on 2.3

#----------------------
# Wrappers for backwards compatibility
# Wrappers for backwards compatibility
#----------------------
"vrppdtw" # 2.1 wraps of _pgr_pickDeliver
"deprecated"
Expand Down Expand Up @@ -179,7 +181,7 @@ CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNU_CXX_MINIMUM_VERSION)
message(FATAL_ERROR "GCC version must be at least ${GNU_CXX_MINIMUM_VERSION}!
message(FATAL_ERROR "GCC version must be at least ${GNU_CXX_MINIMUM_VERSION}!
Found version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
Expand Down Expand Up @@ -320,7 +322,7 @@ endif(NOT PERL_EXECUTABLE)
#---------------------------------------------
find_package(PostgreSQL)
if(NOT POSTGRESQL_FOUND)
message(FATAL_ERROR " Please check your PostgreSQL installation.")
message(FATAL_ERROR " Please check your PostgreSQL installation.")
endif(NOT POSTGRESQL_FOUND)

if(NOT POSTGRESQL_VERSION_STRING)
Expand All @@ -332,7 +334,7 @@ string(SUBSTRING "${POSTGRESQL_VERSION_STRING}" 11 -1 POSTGRESQL_VERSION)
# for XbetaY XalphaY XrcY -> X.Y
string(REGEX REPLACE "^([0-9]+)[beta|alpha|rc].*" "\\1.0" POSTGRESQL_VERSION ${POSTGRESQL_VERSION})

#for X.Y.Z -> XY Y<10
#for X.Y.Z -> XY Y<10
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "\\1\\2" PGSQL_VERSION ${POSTGRESQL_VERSION})

if("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}")
Expand Down Expand Up @@ -362,7 +364,7 @@ find_package(Boost ${BOOST_MINIMUM_VERSION})
if(Boost_INCLUDE_DIRS)
message(STATUS "Boost headers were found here: ${Boost_INCLUDE_DIRS}")
else(Boost_INCLUDE_DIRS)
message(FATAL_ERROR " Please check your Boost installation ")
message(FATAL_ERROR " Please check your Boost installation ")
endif(Boost_INCLUDE_DIRS)

include_directories(${Boost_INCLUDE_DIRS})
Expand Down Expand Up @@ -545,7 +547,7 @@ if(WITH_INTERNAL_TESTS)
endif()

#-------------------
# add the subdirectories that have the C/C++ code
# add the subdirectories that have the C/C++ code
#-------------------

foreach (subdir ${PgRouting_SOURCE_NAMES})
Expand Down Expand Up @@ -643,4 +645,3 @@ if (PGROUTING_DEBUG)
message(STATUS ${f})
endforeach()
endif()

70 changes: 70 additions & 0 deletions include/drivers/dijkstraTRSP/dijkstraTRSP_driver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*PGR-GNU*****************************************************************
File: dijkstraTRSP_driver.h

Generated with Template by:
Copyright (c) 2015 pgRouting developers
Mail: project@pgrouting.org

Function's developer:
Copyright (c) 2015 Celia Virginia Vergara Castillo
Mail: vicky_vergara@hotmail.com

------

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*/

#ifndef INCLUDE_DRIVERS_DIJKSTRATRSP_DIJKSTRATRSP_DRIVER_H_
#define INCLUDE_DRIVERS_DIJKSTRATRSP_DIJKSTRATRSP_DRIVER_H_
#pragma once

#include "c_types/pgr_edge_t.h"
#include "c_types/general_path_element_t.h"

#ifdef __cplusplus
extern "C" {
#endif

/*********************************************************
TEXT,
TEXT,
BIGINT,
BIGINT,
directed BOOLEAN DEFAULT true,
only_cost BOOLEAN DEFAULT false,
********************************************************/


void
do_pgr_dijkstraTRSP(
pgr_edge_t *data_edges,
size_t total_edges,
int64_t start_vid,
int64_t end_vid,
bool directed,
bool only_cost,
General_path_element_t **return_tuples,
size_t *return_count,
char ** log_msg,
char ** notice_msg,
char ** err_msg);


#ifdef __cplusplus
}
#endif

#endif // INCLUDE_DRIVERS_DIJKSTRATRSP_DIJKSTRATRSP_DRIVER_H_
13 changes: 13 additions & 0 deletions sql/dijkstraTRSP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

SET(LOCAL_FILES
dijkstraTRSP.sql
)

# Do not modify bellow this line

foreach (f ${LOCAL_FILES})
configure_file(${f} ${f})
list(APPEND PACKAGE_SQL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${f})
endforeach()

set(PgRouting_SQL_FILES ${PgRouting_SQL_FILES} ${PACKAGE_SQL_FILES} PARENT_SCOPE)
47 changes: 47 additions & 0 deletions sql/dijkstraTRSP/dijkstraTRSP.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*PGR-GNU*****************************************************************
File: dijkstraTRSP.sql

Generated with Template by:
Copyright (c) 2016 pgRouting developers
Mail: project@pgrouting.org

Function's developer:
Copyright (c) 2017 Vidhan Jain
Mail: vidhanj1307.com

------

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*/

CREATE OR REPLACE FUNCTION pgr_dijkstraTRSP(
TEXT,
TEXT,
BIGINT,
BIGINT,
directed BOOLEAN DEFAULT true,
only_cost BOOLEAN DEFAULT false,
OUT seq INTEGER,
OUT path_seq INTEGER,
OUT node BIGINT,
OUT edge BIGINT,
OUT cost FLOAT,
OUT agg_cost FLOAT)

RETURNS SETOF RECORD AS
'$libdir/${PGROUTING_LIBRARY_NAME}', 'dijkstraTRSP'
LANGUAGE c IMMUTABLE STRICT;

32 changes: 32 additions & 0 deletions src/dijkstraTRSP/doc/doc-pgr_dijkstraTRSP.queries
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BEGIN;
BEGIN
-- q1
SELECT * FROM pgr_dijkstraTRSP(
'SELECT id, source, target, cost, reverse_cost FROM edge_table',
2, 3
);
seq | path_seq | node | edge | cost | agg_cost
-----+----------+------+------+------+----------
1 | 1 | 2 | 4 | 1 | 0
2 | 2 | 5 | 8 | 1 | 1
3 | 3 | 6 | 9 | 1 | 2
4 | 4 | 9 | 16 | 1 | 3
5 | 5 | 4 | 3 | 1 | 4
6 | 6 | 3 | -1 | 0 | 5
(6 rows)

-- q2
SELECT * FROM pgr_dijkstraTRSP(
'SELECT id, source, target, cost, reverse_cost FROM edge_table',
2, 3,
FALSE
);
seq | path_seq | node | edge | cost | agg_cost
-----+----------+------+------+------+----------
1 | 1 | 2 | 2 | 1 | 0
2 | 2 | 3 | -1 | 0 | 1
(2 rows)

-- q3
ROLLBACK;
ROLLBACK
Loading