Skip to content

Commit

Permalink
no name parameters on _pgr_vrpOneDepot
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Jun 28, 2017
1 parent 68bf3ff commit 43e94b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions doc/vrp_basic/pgr_vrpOneDepot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Example:

.. literalinclude:: doc-pgr_vrpOneDepot.queries

.. rubric:: Current Result

.. literalinclude:: oneDepotWrapper.queries


.. rubric:: Data

.. literalinclude:: ../../tools/testers/vrpOneDepot.data
Expand Down
19 changes: 10 additions & 9 deletions sql/vrp_basic/_pgr_vrpOneDepot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


CREATE OR REPLACE FUNCTION _pgr_vrpOneDepot(
customers_sql TEXT,
vehicles_sql TEXT,
TEXT, -- customers_sql
TEXT, -- vehicles_sql
TEXT, -- matrix_sql
depot_id INTEGER,
INTEGER, -- depot_id

OUT seq INTEGER,
OUT vehicle_seq INTEGER,
Expand All @@ -58,25 +58,25 @@ final_sql TEXT;
BEGIN

orders_sql = $$WITH
vrp_orders AS ($$ || customers_sql || $$ ),
vrp_orders AS ($$ || $1 || $$ ),
pickups AS (
SELECT id, x AS p_x, y AS p_y, open_time AS p_open, close_time AS p_close, service_time AS p_service
FROM vrp_orders
WHERE id = $$ || depot_id || $$
WHERE id = $$ || $4 || $$
)
SELECT vrp_orders.id AS id, order_unit AS demand, pickups.id AS p_node_id, p_x, p_y, p_open, p_close, p_service,
vrp_orders.id AS d_node_id, x AS d_x, y AS d_y, open_time AS d_open, close_time AS d_close, service_time AS d_service
FROM vrp_orders, pickups
WHERE vrp_orders.id != $$ || depot_id;
WHERE vrp_orders.id != $$ || $4;


trucks_sql = $$ WITH
vrp_orders AS ($$ || customers_sql || $$ ),
vrp_vehicles AS ($$ || vehicles_sql || $$ ),
vrp_orders AS ($$ || $1 || $$ ),
vrp_vehicles AS ($$ || $2 || $$ ),
starts AS (
SELECT id AS start_node_id, x AS start_x, y AS start_y, open_time AS start_open, close_time AS start_close, service_time AS start_service
FROM vrp_orders
WHERE id = $$ || depot_id || $$
WHERE id = $$ || $4 || $$
)
SELECT vehicle_id AS id, capacity, starts.* FROM vrp_vehicles, starts;
$$;
Expand All @@ -98,3 +98,4 @@ BEGIN
END;
$BODY$
LANGUAGE plpgsql VOLATILE STRICT;

0 comments on commit 43e94b8

Please sign in to comment.