vrp_oneDepot - Experimental

Warning

Possible server crash

  • These functions might create a server crash

Warning

Experimental functions

  • They are not officially of the current release.

  • They likely will not be officially be part of the next release:

    • The functions might not make use of ANY-INTEGER and ANY-NUMERICAL

    • Name might change.

    • Signature might change.

    • Functionality might change.

    • pgTap tests might be missing.

    • Might need c/c++ coding.

    • May lack documentation.

    • Documentation if any might need to be rewritten.

    • Documentation examples might need to be automatically generated.

    • Might need a lot of feedback from the comunity.

    • Might depend on a proposed function of vrpRouting

    • Might depend on a deprecated function of vrpRouting

Availability

Version 0.0.0

  • New experimental function

    • Ported pgr_vrpOneDepot from pgRouting v3.1.3

Description

  • TBD

Signatures

  • TBD

Parameters

  • TBD

Inner Queries

  • TBD

Result Columns

  • TBD

Example

BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
SELECT * FROM vrp_oneDepot(
    'SELECT * FROM solomon_100_RC_101',
    'SELECT * FROM vrp_vehicles',
    'SELECT * FROM vrp_distance',
    1);
ERROR:  relation "solomon_100_rc_101" does not exist
LINE 2:     vrp_orders AS (SELECT * FROM solomon_100_RC_101 ),
                                         ^
QUERY:  WITH
    vrp_orders AS (SELECT * FROM solomon_100_RC_101 ),
    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 = 1
    )
    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 != 1
CONTEXT:  PL/pgSQL function _vrp_onedepot(text,text,text,integer) line 46 at RETURN QUERY
SQL function "vrp_onedepot" statement 1
ROLLBACK;
ROLLBACK

Data


DROP TABLE IF EXISTS public.solomon_100_RC_101 cascade;
CREATE TABLE public.solomon_100_RC_101 (
    id integer NOT NULL PRIMARY KEY,
    order_unit integer,
    open_time integer,
    close_time integer,
    service_time integer,
    x float8,
    y float8
);

COPY public.solomon_100_RC_101
(id, x, y, order_unit, open_time, close_time, service_time) FROM stdin;
1	40.000000	50.000000	0	0	240	0
2	25.000000	85.000000	20	145	175	10
3	22.000000	75.000000	30	50	80	10
4	22.000000	85.000000	10	109	139	10
5	20.000000	80.000000	40	141	171	10
6	20.000000	85.000000	20	41	71	10
7	18.000000	75.000000	20	95	125	10
8	15.000000	75.000000	20	79	109	10
9	15.000000	80.000000	10	91	121	10
10	10.000000	35.000000	20	91	121	10
11	10.000000	40.000000	30	119	149	10
\.

DROP TABLE IF EXISTS public.vrp_vehicles cascade;
CREATE TABLE public.vrp_vehicles (
    vehicle_id integer not null primary key,
    capacity integer,
    case_no integer
);

copy public.vrp_vehicles (vehicle_id, capacity, case_no) from stdin;
1	200	5
2	200	5
3	200	5
\.

DROP TABLE IF EXISTS public.vrp_distance cascade;
WITH
the_matrix_info AS (
    SELECT A.id AS src_id, B.id AS dest_id, sqrt( (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) AS cost
    FROM solomon_100_rc_101 AS A, solomon_100_rc_101 AS B WHERE A.id != B.id
)
SELECT src_id, dest_id, cost, cost AS distance, cost AS traveltime
INTO public.vrp_distance
FROM the_matrix_info;

See Also

Indices and tables