返回数据集目录
任务型 RL终端任务英语

Terminal-Bench-4.0

终端环境中的长流程智能体任务

可复现环境自动验证器多工具协作
完整数据规模
500 任务
当前样例题目
2 项任务
样例文件数量
441
样例文件总体量
18.6 MB
题目与目录接口

在线预览仅展示题目与文件目录;完整原始样例包可登记后下载。

dispatch-routing-under-reversible-occupancy

Optimize continuous dispatch routing under reversible occupancy

Optimize continuous dispatch routing under reversible occupancy

A dispatch planning service routes point agents through a rectangular floor around occupied pallet slots. A slot has a fixed rectangular footprint, but its occupancy changes as pallets arrive and leave. Dispatch requests continue between those changes. The current service computes correct continuous Euclidean routes, but it does not meet the throughput needed for repeated dispatch planning. Improve the implementation while preserving its geometry, update semantics and wire interface.

The editable project is /opt/dispatch_router. It contains a complete C++17 implementation, a build script, a streamed client, compatibility fixtures and five simulated workload sessions. The supplied warehouse layouts are constructed benchmarks; these sessions are a computational dispatch model, not surveyed floor plans or recorded vehicle movements. /opt/dispatch_baseline contains the separately installed starting implementation for performance comparison. The baseline is already compiled with -O3.

Deliver an optimized, reusable planner. Choose the algorithm, representation, reuse policy and execution arrangement. Correctness applies to all valid inputs in the supported domain; the performance objective applies to the stated workload family. Reading the code, locating the expensive work and choosing an improvement are part of the assignment.

Required behavior

All scene and route coordinates are integer millimetres, in Cartesian x/y coordinates. The outer rectangle is closed. Each active slot forbids its open interior. Touching an obstacle corner, following an obstacle edge and following the outer boundary are allowed. Inactive slots impose no obstruction. The agent is a point, and the cost is Euclidean polyline length in millimetres. Every valid pair of endpoints is connected under this domain contract.

For each PATH, return a feasible route with globally minimum Euclidean length, within the numerical tolerance below. A route optimal only in a chosen triangle corridor, a raster or another surrogate graph does not establish the required result. Any equally short feasible route is accepted; waypoint and search tie order need not match the baseline.

SET atomically changes the listed occupancy states. Subsequent queries must use the resulting state. Both activation and deactivation matter: a removal can introduce a shorter route, and an addition can invalidate a former route. A command that changes at least one slot increments the scene revision once. Empty updates and requests setting slots to their existing values retain the revision. Return the number of slots actually changed.

Return INVALID when either endpoint lies outside the closed outer rectangle or inside an active open rectangle. A valid coincident-endpoint request returns exactly one waypoint and length zero. Routes must begin and end at the requested coordinates, remain in free space, and use exact integer coordinates for their emitted waypoints. Redundant free waypoints are allowed subject to the protocol's count bound.

Let L be the exact continuous optimum. The returned polyline length must differ from L by at most 2e-9 * max(1, L) millimetres. Its reported length must agree with its geometric length to the same tolerance. Collision decisions have no geometric tolerance: a one-millimetre obstacle may not disappear, and boundary contact may not become collision. Finite-precision metric calculations must not change those topological rules.

The complete supported domain and ASCII wire grammar are in /opt/dispatch_router/docs/protocol.md. In particular, support zero through 1,536 disjoint inventory rectangles, bounds within [0, 10^9], up to 10,000 path queries and 1,000 update commands per process, and up to 64 distinct slots per update. Rectangle rows can arrive in any ID order. Request IDs increase strictly but may have gaps. Query coordinates can be outside the scene within the documented range. Inventory footprints are fixed throughout a process and are disjoint even when inactive.

The executable reads one scene from stdin, emits READY, then reads commands and flushes one reply per command. The client sends each command only after receiving the previous reply. It withholds later commands and keeps stdin open; the implementation must work in this arrangement. End the process cleanly after QUIT. Diagnostic output belongs on stderr.

Performance objective

On the five supplied sessions, achieve a geometric mean speedup of at least 6.0 over /opt/dispatch_baseline/bin/router. No individual case may take more than 1.25 times its baseline time. Use the median of three fresh-process runs of each implementation per case, under the same four-CPU allowance. The same target is intended for sessions with the corresponding size, occupancy, locality and update patterns described in /opt/dispatch_router/docs/workloads.md, including different seeds, geometry dimensions and inventory order. Functional support extends beyond those performance cases to the full input domain.

Time is wall time from process launch through its clean exit after the entire session. It includes scene ingestion and validation, preprocessing, every update, every query and response serialization. Compilation, staging the input, comparing results and independently checking retained routes are excluded. The supplied benchmark client enforces sequential request/reply operation, pins each server to at most four available CPUs and validates its retained replies after the timed session. Initialization and command round trips are also reported as diagnostic phases.

Use only the supplied Linux CPU container: four CPUs, 8 GiB memory and a declared 20 GiB storage budget. Work is offline. Preprocessing and caches created inside a session are allowed and included in its time. Each session starts with a fresh process and a fresh temporary working directory. Derive scene-specific state from stdin during that session; the executable must not read known workload files, use precomputed workload-specific answers or reuse a scene index from a prior process. It may read its own implementation assets. Algorithmic correctness and performance must survive unseen valid scenes and request sequences.

Starting materials and tools

  • /opt/dispatch_router/src/ and include/: the working planner, exact integral rectangle-interior predicate and stdin server.
  • /opt/dispatch_router/data/sessions/ and data/workloads.json: materialized performance inputs and their dimensions, counts and hashes.
  • /opt/dispatch_router/fixtures/: boundary, large-coordinate, no-op update, inactive-slot endpoint and changing-scene checks, including original warehouse query coordinates scaled to millimetres.
  • /opt/dispatch_router/tools/: replay and comparison clients, plus an independent exact breakpoint check of route feasibility. The feasibility checker does not certify optimality.
  • /opt/dispatch_router/docs/geometry.md: the geometric and numerical foundations of the starting planner; docs/sources.md records the input provenance and relevant original literature.

GCC/G++, Make, CMake, Ninja, Python 3 with NumPy, Boost headers, Eigen, CGAL/GMP/MPFR, GDB, Valgrind, strace, GNU time and Poppler PDF utilities are installed. There is no dependency on a live service. You can change the implementation language or build system using locally installed tools, provided the launch and build interfaces remain as specified.

Start with:

cd /opt/dispatch_router
./build.sh
python3 tools/smoke.py --program ./bin/router
python3 tools/benchmark.py --program ./bin/router --repetitions 1 --case crossdock_edits

The existing implementation is the performance starting point. The supplied fixtures are useful compatibility checks, and the benchmark compares lengths with the baseline; neither replaces your justification that the improved method preserves the continuous objective over the entire supported domain.

Deliverables

Keep the completed project at /opt/dispatch_router, which is the directory transferred for later use. Preserve the supplied fixtures, sessions and protocol documentation. Put all additional source files, implementation assets and runtime dependencies needed by your result within that directory. A fresh offline container receives this directory at the same absolute path.

The following interfaces and files are required:

  1. /opt/dispatch_router/build.sh: an executable, noninteractive build entry point. Running it from any working directory must rebuild the result offline with the installed tools and exit zero. Include the complete editable sources. Keep build products within the project.
  2. /opt/dispatch_router/bin/router: an executable launch entry point taking no arguments and implementing the documented stdin/stdout protocol. Include it in the delivered tree; it must also be reproducible by the build script. The launcher must work from an arbitrary working directory and after restoration at its declared path.
  3. /opt/dispatch_router/PERFORMANCE.md: explain the final method, the invariants that preserve global route optimality and occupancy revisions, how exact collision semantics coexist with numerical metric calculations, and the relevant time and storage costs. Include measured three-run comparisons on all five cases, initialization/update/query phase costs, peak resident memory with its measurement method, and any remaining tradeoffs. Provide commands another engineer can repeat.
  4. /opt/dispatch_router/evidence/benchmark.json: the machine-readable report from the supplied comparison client with three repetitions on all five cases, using the installed baseline. Retain candidate transcripts for those cases under /opt/dispatch_router/evidence/transcripts/, and check them with the independent feasibility tool.

Add regression cases appropriate to the optimization and keep their runnable source or native input files in the project. Include changing-state routes, reverse occupancy changes, boundary contacts, invalid endpoints, large coordinates and correctness on layouts beyond a single regular shelf pattern. Finish the build, compatibility checks, complete benchmark and retained-route checks before delivery. Keep the installed baseline fixed for comparison. The delivered router must run using the captured project and the stated system tools and libraries.

题目文件:tasks/dispatch-routing-under-reversible-occupancy/instruction.md