VRPTW dispatch: parallel-round savings construction and penalised inter-route local search
/app/cpu/main.cpp is a multicore CPU program (C++17, OpenMP). It is built as
/app/bin/cpu_baseline with g++ -O3 -march=native -fopenmp -std=c++17 and run as
cpu_baseline INPUT_FILE
It reads one input file and writes its result to stdout.
What the program computes
A vehicle-routing planner with time windows (VRPTW), run on several independent instances. Everything is exact integer arithmetic; the CPU source is the specification.
Per instance (n customers, seed s):
- Instance. Customers get coordinates on a 10000x10000 grid (65% around 8-31 cluster
centres, the rest uniform), demand 1..25, service time 6..20 and a time window around a
random centre (half wide 4000-9000, half narrow 800-2400), clipped so that a direct
depot round trip is feasible. The depot is customer index
nat (5000, 5000) with window[0, 30000]. Distance = travel time =floor(sqrt(dx^2 + dy^2))(exact integer square root). Each customer gets its 24 nearest other customers (squared distance, ties by lower index). - Savings construction, in rounds, starting from one route per customer (route id = its
customer). Each route
rproposes the merge "r then q" for the best route head reachable from its tail's neighbour list, with saving4*(d(t,0)+d(0,h)) - 5*d(t,h) > 0, total load<= 180, and zero time warp of the merged route. Each route accepts its best incoming proposal (keysaving << 32 | (2^32-1-r)); a merge is applied only if its key is larger than the keys of the accepted merge intorand the accepted merge out ofq. Merged routes keep the id of the first route. Rounds end when nothing is applied. - Penalised local search, in rounds. Route cost = distance + 3 * time warp + 11 * load
excess over 180 + 650 per non-empty route; time windows are soft (Vidal-style segment
summaries: duration, time warp, earliest/latest start, distance, load, concatenated in
O(1)). Every customer
uscans its neighboursvin another route and five moves: relocateuafterv, relocateubeforev, 2-opt* (exchange the tails afteruand afterv), exchangeuandv, and move the block (u, successor ofu) afterv. Its best strictly improving move (first found in neighbour order, then move order) gets keygain << 24 | (2^24-1-u). A move is applied only if its key is the largest among all moves touching each of its two routes, so applied moves are route-disjoint. Rounds end when no move is applied (or after 3000 rounds; savings cap 2000 rounds). - Report fleet, distance, time warp, overload, cost, route-length histogram and an order-independent hash of all route sequences.
Input format
I
n_1 seed_1
...
n_I seed_I
Output format
Per instance k:
INST k n <n> sav_rounds <r> merges <m> sav_cost <c> ls_rounds <r> moves <relocate_after> <relocate_before> <2opt*> <exchange> <oropt>
RESULT k routes <R> dist <D> timewarp <TW> late_routes <x> overload <o> cost <C> maxlen <L>
SIZES k <len<=5> <6-10> <11-15> <16-20> <21-30> <31+> HASH <hex>
then TOTAL cost <sum of instance costs>. Everything must match exactly.
Hidden inputs
Correctness inputs (10 files, 1-4 instances each) include instances with n = 0, 1, 2, 3,
tiny instances, and random instances with n <= 3000. The timing input has 24 instances with
n uniform in [12000, 16000]. Always 0 <= n <= 20000.
Your task
Port this program to CUDA in /app/gpu/main.cu: same command line (PROGRAM INPUT_FILE),
same output on stdout. Then make it as fast as you can on the GPU while keeping the output correct.
The main computation must execute on the GPU. Renaming CPU code to .cu, running a
CPU fallback, or launching a dummy kernel while computing the answer on the CPU does not satisfy this task.
The CPU source is the specification: when this text and the code disagree, the code wins.
How you are scored
- Only
/app/gpu/main.cuis collected. It is compiled withnvcc -O3 -arch=sm_90 -std=c++17 -o port /app/gpu/main.cu; no extra libraries are linked. The CUDA runtime and the header-only libraries that ship with the CUDA toolkit (CUB, Thrust, libcu++) are allowed. - Your source must not contain any of:
system(,popen(,fork(,exec*,dlopen(,getenv(,#include <filesystem>,/tests/,/proc/. The program may read only the input file it is given. - GPU verification uses the backend selected for this run: an H100 attached to the separate verifier, or a remote H100 worker. Hidden inputs use a fresh random seed.
- For public GPU experiments, use
/app/bin/gpu_run [--backend auto|local|remote] [--repeat N] [--quiet] SOURCE.cu INPUT_FILE.... The default usesGPU_RUNNER_URLwhen configured, otherwise a GPU attached to this sandbox. Sandbox GPU access is configured independently from verification; a CPU-only sandbox needs a runner URL. - Correctness: every hidden input (small edge cases plus the timing input) must pass. Your output must be identical to the CPU program's output (trailing whitespace ignored). Any mismatch, crash or timeout gives reward 0.
- GPU execution: a separate, untimed CUPTI check must observe completed GPU kernel activity on the hidden timing input. A CPU-only submission receives reward 0 even if its output is correct.
- Speed: The timing input has 24 independent instances with 12000-16000 customers each. Your port and our GPU reference are each run on it
once to warm up and then 5 times, interleaved; the time is the wall clock of the whole process
(including CUDA initialisation, input parsing and output). When correct,
reward = min(2, t_reference / t_yours)using the medians. /app/inputs/holds a few public inputs./app/bin/run_public.shcompiles your port with the flags above and compares it against the CPU baseline on each of them.