64 lines
2.3 KiB
Markdown
64 lines
2.3 KiB
Markdown
# pp-jobboard-sim
|
||
|
||
High-throughput, deterministic offline Rust job-board generator and economy simulator implementing the clean-room job-board specification.
|
||
|
||
No proprietary game assets or hardcoded plane catalogs are required—supply your own `--world` / `--ourairports` and `--planes-file` JSON, or use the built-in synthetic world generator for rapid benchmarking.
|
||
|
||
## Build
|
||
|
||
```bash
|
||
cargo build --release
|
||
cargo test --release
|
||
```
|
||
|
||
## Usage
|
||
|
||
### 1. Single airport board (`board`)
|
||
|
||
```bash
|
||
# Synthetic world (default 4,000 global airports)
|
||
./target/release/pp-jobboard-sim board \
|
||
--airport S0000 \
|
||
--planes light_piston,skyliner \
|
||
--salt 123456789 \
|
||
--at 1796067000000 \
|
||
--level 2 \
|
||
--partition
|
||
|
||
# Custom world JSON + planes JSON
|
||
./target/release/pp-jobboard-sim \
|
||
--world data/world.json \
|
||
--planes-file data/planes.json \
|
||
board --airport KSAN --planes skylark,skyliner --master my-seed --json
|
||
```
|
||
|
||
### 2. Large-scale parallel global simulation (`sim`)
|
||
|
||
```bash
|
||
# In-memory analytics across 4,000 airports × 48 buckets × all planes (1.536M boards / ~13.3M jobs)
|
||
./target/release/pp-jobboard-sim sim --synthetic-airports 4000 --buckets 48
|
||
|
||
# Export all generated jobs to CSV for DuckDB / Polars / Pandas analysis
|
||
./target/release/pp-jobboard-sim sim \
|
||
--world data/world.json \
|
||
--planes-file data/planes.json \
|
||
--master balance-run-1 \
|
||
--buckets 48 \
|
||
--mode csv \
|
||
--out jobs.csv
|
||
|
||
# Or load public-domain OurAirports airports.csv directly
|
||
./target/release/pp-jobboard-sim \
|
||
--ourairports airports.csv \
|
||
--planes-file data/planes.json \
|
||
sim --buckets 48 --mode stats --json
|
||
```
|
||
|
||
## Performance architecture
|
||
|
||
- **Per-origin sorted major & pad caches** inside thread-local `BoardScratch` with `partition_point` binary search (`O(log M + K)`, zero per-slot trig or sorting).
|
||
- **4°×4° spatial grid + precomputed neighbor cache** built in parallel via Rayon with unit-sphere chord-squared filtering (3 FMAs, zero trig).
|
||
- **Precomputed spread LUTs** (`(i+1)^(1/p) - i^(1/p)`) eliminating billions of `powf()` calls in weighted destination sampling.
|
||
- **3D unit-sphere cross-track prefilter** (`dot(normalize(A × B), S)`) for passenger photo detours.
|
||
- **Zero-contention Rayon fold/reduce** with mergeable fixed-bucket histograms, reusable `Vec<Job>` buffers, and `itoa`/`ryu` CSV writers.
|