Vehicle Routing Functions - Category (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
Contents
Functions
Parameters¶
Pick & deliver¶
Both implementations use the following same parameters:
Column  | 
Type  | 
Default  | 
Description  | 
|---|---|---|---|
orders_sql  | 
  | 
Pick & Deliver Orders SQL query containing the orders to be processed.  | 
|
vehicles_sql  | 
  | 
Pick & Deliver Vehicles SQL query containing the vehicles to be used.  | 
|
factor  | 
  | 
1  | 
(Optional) Travel time multiplier. See Factor Handling  | 
max_cycles  | 
  | 
10  | 
(Optional) Maximum number of cycles to perform on the optimization.  | 
initial_sol  | 
  | 
4  | 
(Optional) Initial solution to be used. 
  | 
The non euclidean implementation, additionally has:
Column  | 
Type  | 
Description  | 
|---|---|---|
matrix_sql  | 
  | 
Pick & Deliver Matrix SQL query containing the distance or travel times.  | 
Pick & Deliver Orders SQL¶
In general, the columns for the orders SQL is the same in both implementation of pick and delivery:
Column  | 
Type  | 
Default  | 
Description  | 
|---|---|---|---|
id  | 
ANY-INTEGER  | 
Identifier of the pick-delivery order pair.  | 
|
demand  | 
ANY-NUMERICAL  | 
Number of units in the order  | 
|
p_open  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the pickup location opens.  | 
|
p_close  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the pickup location closes.  | 
|
d_service  | 
ANY-NUMERICAL  | 
0  | 
The duration of the loading at the pickup location.  | 
d_open  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the delivery location opens.  | 
|
d_close  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the delivery location closes.  | 
|
d_service  | 
ANY-NUMERICAL  | 
0  | 
The duration of the loading at the delivery location.  | 
For the non euclidean implementation, the starting and ending identifiers are needed:
Column  | 
Type  | 
Description  | 
|---|---|---|
p_node_id  | 
ANY-INTEGER  | 
The node identifier of the pickup, must match a node identifier in the matrix table.  | 
d_node_id  | 
ANY-INTEGER  | 
The node identifier of the delivery, must match a node identifier in the matrix table.  | 
For the euclidean implementation, pick up and delivery \((x,y)\) locations are needed:
Column  | 
Type  | 
Description  | 
|---|---|---|
p_x  | 
ANY-NUMERICAL  | 
\(x\) value of the pick up location  | 
p_y  | 
ANY-NUMERICAL  | 
\(y\) value of the pick up location  | 
d_x  | 
ANY-NUMERICAL  | 
\(x\) value of the delivery location  | 
d_y  | 
ANY-NUMERICAL  | 
\(y\) value of the delivery location  | 
Pick & Deliver Vehicles SQL¶
In general, the columns for the vehicles_sql is the same in both implementation of pick and delivery:
Column  | 
Type  | 
Default  | 
Description  | 
|---|---|---|---|
id  | 
ANY-INTEGER  | 
Identifier of the pick-delivery order pair.  | 
|
capacity  | 
ANY-NUMERICAL  | 
Number of units in the order  | 
|
speed  | 
ANY-NUMERICAL  | 
1  | 
Average speed of the vehicle.  | 
start_open  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the starting location opens.  | 
|
start_close  | 
ANY-NUMERICAL  | 
The time, relative to 0, when the starting location closes.  | 
|
start_service  | 
ANY-NUMERICAL  | 
0  | 
The duration of the loading at the starting location.  | 
end_open  | 
ANY-NUMERICAL  | 
start_open  | 
The time, relative to 0, when the ending location opens.  | 
end_close  | 
ANY-NUMERICAL  | 
start_close  | 
The time, relative to 0, when the ending location closes.  | 
end_service  | 
ANY-NUMERICAL  | 
start_service  | 
The duration of the loading at the ending location.  | 
For the non euclidean implementation, the starting and ending identifiers are needed:
Column  | 
Type  | 
Default  | 
Description  | 
|---|---|---|---|
start_node_id  | 
ANY-INTEGER  | 
The node identifier of the starting location, must match a node identifier in the matrix table.  | 
|
end_node_id  | 
ANY-INTEGER  | 
start_node_id  | 
The node identifier of the ending location, must match a node identifier in the matrix table.  | 
For the euclidean implementation, starting and ending \((x,y)\) locations are needed:
Column  | 
Type  | 
Default  | 
Description  | 
|---|---|---|---|
start_x  | 
ANY-NUMERICAL  | 
\(x\) value of the coordinate of the starting location.  | 
|
start_y  | 
ANY-NUMERICAL  | 
\(y\) value of the coordinate of the starting location.  | 
|
end_x  | 
ANY-NUMERICAL  | 
start_x  | 
\(x\) value of the coordinate of the ending location.  | 
end_y  | 
ANY-NUMERICAL  | 
start_y  | 
\(y\) value of the coordinate of the ending location.  | 
Pick & Deliver Matrix SQL¶
Warning
TODO
Description of the result (TODO Disussion: Euclidean & Matrix)¶
RETURNS SET OF
    (seq, vehicle_seq, vehicle_id, stop_seq, stop_type,
        travel_time, arrival_time, wait_time, service_time,  departure_time)
    UNION
    (summary row)
Column  | 
Type  | 
Description  | 
|---|---|---|
seq  | 
INTEGER  | 
Sequential value starting from 1.  | 
vehicle_seq  | 
INTEGER  | 
Sequential value starting from 1 for current vehicles. The \(n_{th}\) vehicle in the solution.  | 
vehicle_id  | 
BIGINT  | 
Current vehicle identifier.  | 
stop_seq  | 
INTEGER  | 
Sequential value starting from 1 for the stops made by the current vehicle. The \(m_{th}\) stop of the current vehicle.  | 
stop_type  | 
INTEGER  | 
Kind of stop location the vehicle is at: 
  | 
order_id  | 
BIGINT  | 
Pickup-Delivery order pair identifier. 
  | 
cargo  | 
FLOAT  | 
Cargo units of the vehicle when leaving the stop.  | 
travel_time  | 
FLOAT  | 
Travel time from previous  
  | 
arrival_time  | 
FLOAT  | 
Previous   | 
wait_time  | 
FLOAT  | 
Time spent waiting for current location to open.  | 
service_time  | 
FLOAT  | 
Service time at current location.  | 
departure_time  | 
FLOAT  | 
\(arrival\_time + wait\_time + service\_time\). 
  | 
Summary Row
Warning
TODO: Review the summary
Column  | 
Type  | 
Description  | 
|---|---|---|
seq  | 
INTEGER  | 
Continues the Sequential value  | 
vehicle_seq  | 
INTEGER  | 
  | 
vehicle_id  | 
BIGINT  | 
Total Capacity Violations in the solution.  | 
stop_seq  | 
INTEGER  | 
Total Time Window Violations in the solution.  | 
stop_type  | 
INTEGER  | 
  | 
order_id  | 
BIGINT  | 
  | 
cargo  | 
FLOAT  | 
  | 
travel_time  | 
FLOAT  | 
total_travel_time The sum of all the travel_time  | 
arrival_time  | 
FLOAT  | 
  | 
wait_time  | 
FLOAT  | 
total_waiting_time The sum of all the wait_time  | 
service_time  | 
FLOAT  | 
total_service_time The sum of all the service_time  | 
departure_time  | 
FLOAT  | 
total_solution_time = \(total\_travel\_time + total\_wait\_time + total\_service\_time\).  | 
See Also
The queries use the Sample Data network.
Indices and tables
