-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
37 lines (24 loc) · 1.54 KB
/
README
File metadata and controls
37 lines (24 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Traveling Zip
Medical delivery simulation: zip systems (drones) are assigned orders, plan routes, and complete flights. C++20.
## Build & run
```bash
mkdir -p build && cd build
cmake ..
make
./traveling_zip
```
Inputs: `../inputs/hospitals.csv`, `../inputs/orders.csv` (relative to run directory).
## Architecture
**Launches**
- **AssignmentPolicy** — Decides which orders go to which zip system (e.g. by priority, hex/grid, or distance). Example: `PriorityBasedAssignmentPolicy`.
- **RoutingPolicy** — Given assigned orders, plans the route (stop order) and sets **ETA** on the returned `Flight`. Example: `TrivialRoutingPolicy` (keeps assignment order, computes ETA from spatial model + speed).
**Queueing**
- Orders are queued by receive time; scheduler processes them in order.
**Timing**
- **ZipSystemStateActor** — Wraps a zip system, holds current `Flight` and state (FREE/BUSY). On `Tick(now)`, if `now >= flight.eta()` it resets. Actor is dumb: it only stores state and advances time.
- **Flight** — Owns launch time, orders, and ETA. ETA is set by the routing policy when the route is planned.
## Key types
- `ZipScheduler` — Owns actors, assignment policy, routing policy, order queue; drives `Tick` and `LaunchFlights`.
- `Flight` — Launch time, order list, ETA (set by `RoutingPolicy::PlanRoute`).
- `ZipSystemStateActor` — Holds system, optional active flight, state; `Assign` stores flight and sets BUSY; `Tick` checks ETA and resets when done.
- `SpatialModelInterface` — Distance between locations (e.g. `EuclideanSpatialModel`).