pgr_gsoc_vrppdtw - Experimental

Name

pgr_gsoc_vrppdtw - Returns a solution for Pick and Delivery with time windows Vehicle Routing Problem

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 pgRouting

    • Might depend on a deprecated function of pgRouting

Signature Summary

pgr_gsoc_vrppdtw(sql, vehicle_num, capacity)
RETURNS SET OF pgr_costResult[]:

Signatures

Complete signature

pgr_gsoc_vrppdtw(sql, vehicle_num, capacity)
Returns set of pgr_costResult[]:

Example: Show the id1

SELECT DISTINCT(id1) FROM pgr_gsoc_vrppdtw(
    'SELECT * FROM customer ORDER BY id', 25, 200)
ORDER BY id1;
 id1
-----
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
(10 rows)

Description of the Signatures

Description of the sql query

Column

Type

Description

id

ANY-INTEGER

Identifier of the customer.

  • A value of 0 identifies the starting location

x

ANY-NUMERICAL

X coordinate of the location.

y

ANY-NUMERICAL

Y coordinate of the location.

demand

ANY-NUMERICAL

How much is added / removed from the vehicle.

  • Negative value is a delivery,

  • Positive value is a pickup,

openTime

ANY-NUMERICAL

The time relative to 0, when the customer opens.

closeTime

ANY-NUMERICAL

The time relative to 0, when the customer closes.

serviceTime

ANY-NUMERICAL

The duration of the loading / unloading.

pIndex

ANY-INTEGER

Value used when the current customer is a Delivery to find the corresponding Pickup

dIndex

ANY-INTEGER

Value used when the current customer is a Pickup to find the corresponding Delivery

Description of the parameters of the signatures

Column

Type

Description

sql

TEXT

SQL query as described above.

vehicle_num

INTEGER

Maximum number of vehicles in the result. (currently is ignored)

capacity

INTEGER

Capacity of the vehicle.

Description of the result

RETURNS SET OF pgr_costResult[]:

Column

Type

Description

seq

INTEGER

Sequential value starting from 1 .

id1

INTEGER

Current vehicle identifier.

id2

INTEGER

Customer identifier.

cost

FLOAT

Previous cost plus travel time plus wait time plus service time .
  • when id2 = 0 for the second time for the same id1 , then has the total time for the current id1

Examples

Example: Total number of rows returned

SELECT count(*) FROM pgr_gsoc_vrppdtw(
    'SELECT * FROM customer ORDER BY id', 25, 200);
 count
-------
   126
(1 row)

Example: Results for only id1 values: 1, 5, and 9

SELECT * FROM pgr_gsoc_vrppdtw(
    'SELECT * FROM customer ORDER BY id', 25, 200)
    WHERE id1 in (1, 5, 9);
 seq  id1  id2        cost
-----+-----+-----+------------------
   1    1    0                 0
   2    1   13  120.805843601499
   3    1   17  214.805843601499
   4    1   18  307.805843601499
   5    1   19  402.805843601499
   6    1   15  497.805843601499
   7    1   16  592.805843601499
   8    1   14  684.805843601499
   9    1   12  777.805843601499
  10    1   50  920.815276724293
  11    1   52  1013.97755438446
  12    1   49  1106.97755438446
  13    1   47  1198.97755438446
  14    1    0  1217.00531076178
  57    5    0                 0
  58    5   90  110.615528128088
  59    5   87  205.615528128088
  60    5   86  296.615528128088
  61    5   83  392.615528128088
  62    5   82  485.615528128088
  63    5   84  581.446480022934
  64    5   85   674.27490714768
  65    5   88   767.27490714768
  66    5   89  860.103334272426
  67    5   91   953.70888554789
  68    5    0  976.069565322888
 105    9    0                 0
 106    9   67  102.206555615734
 107    9   65  193.206555615734
 108    9   63  285.206555615734
 109    9   62  380.206555615734
 110    9   74  473.206555615734
 111    9   72  568.206555615734
 112    9   61  661.206555615734
 113    9   64  663.206555615734
 114    9  102  753.206555615734
 115    9   68  846.206555615734
 116    9    0  866.822083743822
(38 rows)