Database Design - JamesBremner/pickup GitHub Wiki
Persistent data is stored in a sqlite database C:\ProgramData\RavensPoint\Pickup\pickup.dat
Input tables
These tables store data about the zone. They are read by the pickup processing code.
restaurant
Stores location of each restaurant
orderholder
Stores orders:
- time order is ready
- restaurant index
- delivery location
rider
stores initial location of rider.
config
Stores zone configuration
- Dimension of zone
- pickup window ( maximum difference in ready times of orders in stack )
- maximum distance for rider from restaurant
Output tables
These tables are written by the pickup processing code.
stack
stores stacked orders
- index of restaurant
- index of rider assigned to stack
route
stores optimized delivery route for rider assigned to each stack.
The sequence of orders for each stack is the sequence the orders should be delivered to minimize travel distance.
- stack index
- order index
Database schema
CREATE TABLE restaurant ( x, y );
CREATE TABLE orderholder ( rdy, rst, x, y );
CREATE TABLE rider ( x, y );
CREATE TABLE config ( ZoneDimKm, PickupWindowSecs, CloseRiderDistanceKm );
CREATE TABLE stacks ( rst, rider );
CREATE TABLE route ( stack, orderIndex );
Note that sqlite database indices are 1-based.