Batched Simulator#
The folder Fast/ has the batched simulator, the Python package acres_batch. It simulates thousands of drives of the Polaris at one time on a GPU, with PyTorch. Another repository uses it. This page tells only what it simulates. Fast/README.md gives its use.
The folder also has acres_fleet, the Python package of the run-time library (acres_fleet).
What It Simulates#
| Part | Source | Content |
|---|---|---|
| Vehicle | Fast/acres_batch/vehicle.py |
A batch of Polaris vehicles: the Dataspeed steering and speed loops of AcresUtvModel.cpp on Ackermann kinematics, with the gear. The powertrain and the brakes are a PI speed loop with fitted parameters. |
| Path follower and chunks | Fast/acres_batch/follow.py, chunk.py |
The path follower and the maker of path chunks. |
| Checker | Fast/acres_batch/check.py |
The trajectory checker in PyTorch. The checker of the vehicle is the checker of the run-time library. |
| World | Fast/acres_batch/world.py, visibility.py |
People and vehicles that move and react to the vehicle, and the LiDAR scan of them. The line of sight over crests and through standing crop. |
| Scenes | Fast/acres_batch/scenarios*.py, acre.py |
Generators of road scenes: roads, bends, verges, ditches, crests, crops and traffic. acre.py reads the ACRE map. |
| Kernels | Fast/acres_batch/kernels/ |
The checker and the physics of one decision as Triton kernels. |
| Field grids | Fast/acres_batch/fields.py, kernels/stamp.py |
The worked cells of implement sections, the ruts and the tyre passes of each field window of a scene (work package WP5 of the benchmark plan). |
| Ground surrogate | Fast/acres_batch/ground.py, Fast/Tools/ground_tables.cpp |
The slip, the sinkage and the fuel of the Polaris from tables of ACRES Core runs, and the stuck rule (work package WP6). |
| Long routes | Fast/acres_batch/lanes.py, kernels/lanes.py |
The lane graph and the capsule pool of a scene, its routes, and a window of the pool and the route for each vehicle (work package WP2 of the benchmark plan). |
| Weather and soil water | Fast/acres_batch/weather.py |
The weather series of a scene, the soil water of each field and the weather of cut hay (work package WP7). |
| Field curing of hay | Fast/acres_batch/curing.py |
The moisture of the hay of a swath or a windrow from the weather, its density and the day of the mowing or raking (P1, section 3.1). |
| Vehicle kinds and bodies | Fast/acres_batch/vehicle.py, check.py |
A parameter table for each vehicle kind (the Polaris, the Maxxum tractor), a towed trailer, a payload, and the boxes of the body of each row for the checker (work package WP4). |
| Items, slots and resources | Fast/acres_batch/items.py, kernels/items.py |
Round bales and the stack of a shed. The shed door and its worker, gates and docks with one holder. The bale formation of a round baler. The items that each vehicle sees (work package WP8). |
| Skills | Fast/acres_batch/skills/ |
The reference skills of the procedure tier, their scene banks and their verifier, and the environment that runs the calls of the skills (work package WP9). |
Requirements#
The package needs torch and numpy (pyproject.toml). The kernels also need Triton and a CUDA GPU.
The tests are in Tests/Fast. The pytest marker gpu marks a test that needs a CUDA GPU.
Speed and Sync Harness#
The module Fast/acres_batch/bench.py measures the speed of the training loop. One decision has these components:
- The observation (
observe). - The proposals: K candidate actions for each row (
propose). - The checker verdict of the K candidates (
checked). - The pick: the first accepted candidate of each row (
pick). - The step (
step). The step has its check, the physics, the judge, the tracks and faults, and the resets.
The harness does 20 warm-up decisions and then the measured decisions. It gives:
- decisions/s (rows x decisions / s), agent-decisions/s, environment-decisions/s, farm hours for each GPU hour,
- the time of the first decision (this time includes the compilation of the kernels),
- the peak memory, the memory for each row and the memory for each environment,
- the GPU time of each component (CUDA events). The time of a component does not include the time of the components in it,
- the number of host syncs for each decision and the lines of code that make them (a separate pass with
torch.cuda.set_sync_debug_mode("warn")), - the GPU, the driver, and the versions of PyTorch and Triton.
The drive environment needs a judge. The judge is not in this package. Give the judge with --judge module:attribute. A policy can give the proposals with --proposer module:attribute. If you do not give a proposer, the harness uses random actions.
. Benchmark/acres_bench/drive/env.sh
python -m acres_batch.bench --judge acres_bench.drive.judge_drive:Judge --rows 4096 --candidates 32
python -m acres_batch.bench --env base --rows 1024 # env.Env: no judge, the PyTorch physics
python -m acres_batch.bench --env base --rows 1024 --agents 2 # two agents in each scene (Agent Rows)
The tool Fast/Tools/kernel_speed.py runs the drive env and the rounds env with 1, 2 and 3 vehicles for each scene. It runs the code before and after the kernel work (WP11). The results are in Results/Fast/kernel_speed.json (11 Nov 2026, the file of commit fc35b26, not measured again on the final tree).
Use --json FILE to write the result to a file. Use --mem-gb to set a memory limit for the process. If other work uses the GPU, the rates are lower and less stable.
Fast Paths#
The module Fast/acres_batch/fast.py gives the fast paths of an environment. These are the checker, the chunk maker, the reach of a chunk, the physics and the observation in Triton kernels or through torch.compile. An environment chooses its paths one time, when it is made. The paths do not change after that.
| Name | Content |
|---|---|
fast.Paths |
The paths of one environment: check, make, reach (functions), physics and agents (the physics kernel, and the kernel of agent rows), observe (the compiled observation, or none). |
fast.TORCH |
The PyTorch form of each path. |
fast.choose(...) |
The Paths of the settings: the fused checker, chunk maker, reach and physics by default. The environment variables ACRES_BATCH_FUSED_CHECK, _CHUNK, _REACH, _PHYSICS (0: PyTorch) and ACRES_BATCH_FUSED_AGENTS (the kernel of agent rows: on by default since 11 Nov 2026, 0: off) are read when choose runs. |
fast.default() |
The paths that an environment takes when it gets none: fast.TORCH, or the paths of the last fast.enable(...). |
fast.enable(...) |
Sets the default to choose(...). Call it one time at the start of a program. fast.disable() sets the default to fast.TORCH. |
Give the paths to the environment with the argument paths (env.Env, env_drive.DriveEnv, env_rounds.RoundsEnv, skills.env.SkillEnv). Without the argument, the environment takes fast.default() when it is made. The environment calls env.paths.check, env.paths.make and the physics of its paths. fast.enable does not change an environment that exists, and no function is replaced. Thus two environments of one process can have different paths, and a test leaves no changed function for the next test. Tests/Fast/conftest.py makes sure that no test file changes the default.
The functions check.check, chunk.make and reach.reach are for a caller without an environment (the drive planner): they call the paths of fast.default(). check.check_torch, chunk.make_torch and reach.reach_torch are the PyTorch forms. No code of this package calls the three functions in a step.
from acres_batch import env_rounds, fast
env = env_rounds.RoundsEnv(scenes, paths=fast.choose(agents=True)) # the kernels, with the kernel of agent rows
ref = env_rounds.RoundsEnv(scenes, paths=fast.TORCH) # the PyTorch forms
Before 11 Nov 2026, fast.enable replaced check.check, chunk.make, reach.reach, DriveEnv._advance and Env.observe for the whole process. The results of a given setting are the same, bit for bit (the event-log digests of P4, T4, T5 and of the L1 checks of the skills, Results/Fast/robustness.json).
The drive task. The planner and the training of the drive task came from FARMS on 15 Nov 2026. These parts must change:
- The planner calls
check.check,chunk.makeandreach.reachdirectly (Vehicle/Policy/acres_policy/search.py,planner_core.py,candidates.py,Benchmark/acres_bench/drive/train/ppo.py,train/stuck/*.py,eval/eval_drive.py,eval/kit_sim.py). These read the process default at each call. Callenv.paths.check,env.paths.makeandenv.paths.reach. The tests that want the PyTorch forms callcheck.check_torch,chunk.make_torch. fast.grouped()without an environment reads the default. Give the environment:fast.grouped(env).fast._orig,fast.check_fast,fast.make_fastand the optionscompile_checkandcompile_chunkleft on 14 Nov 2026. A function has two forms at most: the PyTorch form (check.check_torch,chunk.make_torch,DriveEnv._advance_torch) and its kernel. The observation and the judge of the drive environment can also go throughtorch.compile(fast.choose(compile_obs=..., compile_judge=...)): that is the same code, not a second form.StuckEnv(Benchmark/acres_bench/drive/train/stuck/env_stuck.py) makes no paths: it hasfast.TORCH. Give itself.pathsin its constructor if it must use the kernels.Benchmark/acres_bench/drive/eval/kit_sim.pyreplaceschunk.makefor a time. The environment does not callchunk.make: give it aPathswith thatmake(dataclasses.replace(env.paths, make=...)).
Defaults of the Settings#
Since 11 Nov 2026 (the decision of the owner), the simulator drives as the vehicle does and steps as training does, by default. The module Fast/acres_batch/defaults.py is the one place of these defaults in the code (DEFAULTS), with the old values (OLD):
| Setting | Default | Old Value | Environment Variable | What the Default Is |
|---|---|---|---|---|
Env.follower |
vehicle |
batched |
ACRES_FOLLOWER |
The path follower of the vehicle's software (chunk_command of the run-time library, ported). |
Env.gearbox |
vehicle |
batched |
ACRES_GEARBOX |
The launch hold and the gear logic of the vehicle node, with the hold of 1.1 s after a change of direction (Gearbox). |
DriveEnv.holds |
vehicle |
batched |
ACRES_HOLDS |
The sensor holds of the vehicle node (Config/holds.json). |
Env.bodies |
rows |
polaris |
ACRES_BODIES |
The body of each vehicle kind in the contact test and the shield (Vehicle Kinds and Bodies). |
Env.sync_free |
on | off | ACRES_SYNC_FREE (0 or 1) |
The step of the drive env with no host sync (Steps without a Host Sync). |
fast.choose(agents=...) |
on | off | ACRES_BATCH_FUSED_AGENTS (0 or 1) |
The physics kernel of several vehicles a scene (Agent Rows). |
vehicle.maxxum() (since 12 Nov 2026) |
core |
assumed |
ACRES_TRACTOR |
core: the speed loop, the steering map and the mass of the Maxxum kinds fitted to the Maxxum of ACRES Core (Vehicle Kinds and Bodies). assumed: the engineering estimates of before. The fitted Maxxum is the default since 12 Nov 2026: it is the tractor of the game. After the tuning of 12 Nov 2026 (dock near a person, the baler after a turn, the lanes of P3) it is equal or better on each check but one. The reference of K7 pick_up passes 63 of 64 test scenes with it and 64 with the assumed one (scene 12: the turn onto the bale's axis overshoots by 11 degrees under the longer steering lag). The val split passes 192 of 192 with each.. Results/Benchmarks/tractor_default.json. The Polaris does not change. |
The reason: the benchmark must measure its reference solutions and the learned baselines on the behaviour of the vehicle and on one random stream. The settings of training change the random draws, thus results with and without them are not equal bit for bit.
The environment variable sets the default of a process when the module imports its settings.
fast.choose reads its variable when it runs, and DriveEnv reads ACRES_HOLDS when it starts.
An environment can also set its own value before its first step. For example, the settings of prior benchmarks:
ACRES_FOLLOWER=batched ACRES_GEARBOX=batched ACRES_HOLDS=batched ACRES_BODIES=polaris ACRES_SYNC_FREE=0 ACRES_BATCH_FUSED_AGENTS=0 ACRES_TRACTOR=assumed python ...
defaults.OLD_ENVIRONMENT gives these variables. The event log keeps the process defaults in its versions (settings). A run again with other defaults does not repeat the log, and the comparison names the field settings.
The drive recipes use the same simulator defaults as the other benchmarks.
Speed with the new defaults (Results/Fast/speed_defaults.json, commit dfd3194, 13 Nov 2026, an NVIDIA L40S with no other work on it). The file has 2 runs of each, old and new interleaved, the best, 200 decisions after 20. The drive env with 2,048 scenes of 2 agents gives 38,400 to 96,400 agent-decisions/s with one candidate. With 32 candidates it gives 32,900 to 61,000. (This is with the kernel of agent rows and the step with no host sync: 7 host syncs a decision before, 0 after.) The rounds env (P4, 1,024 scenes of 2 vehicles): 71,600 and 100,500. The procedure env (the refill task, 2,048 scenes of 2 vehicles): 154,300 and 156,100 with one plan a decision, 81,200 and 82,000 with the reference skills.
The new defaults meet both targets of benchmarks.md 7.5 for the drive env (50,000 with one candidate, 5,000 with 32). The run of 12 Nov 2026 (commit 2d4c689) was on an L40S that other work used at 98 %, and gave 18,700 and 26,500 with the new defaults. The same tool also ran on the second machine (Results/Fast/speed_defaults_5060ti.json, an NVIDIA GeForce RTX 5060 Ti of 16 GB, the same commit). There the drive env gives 29,900 to 63,600 with one candidate and 20,700 to 30,000 with 32. The rounds env gives 80,300 and 85,100. The procedure env gives 164,700 and 164,500 (48,200 and 48,300 with the reference skills).
Results/Benchmarks/defaults_switch.json has the validity checks of every task and skill bank before and after the switch. The table of the benchmark design, section 7.6, has them too (the status of the switch).
Steps without a Host Sync#
A host sync makes the CPU wait for the GPU. It stops the queue of GPU work, and a step of a small batch then takes most of its time in the CPU.
The setting Env.sync_free removes the host syncs from the step of the drive env (env_drive.DriveEnv). It is on by default since 11 Nov 2026 (Defaults of the Settings). The environment variable ACRES_SYNC_FREE=0 sets the old default of a process. With the setting:
- A reset makes the new values of every row and keeps them only where its mask is (
env.Rows). It needs no list of the rows that end, thus no host sync. The random draws are for every row. Thus the draws are not those of the default reset. - The route tables of the verifier come from a table for each bank row (
DriveEnv.bank_tables). The environment makes this table at the first reset. It holds 6 values for each route point of each bank row, for the route and for the other route. - A reroute takes the route tables of the other route from the same table.
- With
env.live(the rows of a rollout that ended), the checker checks every row, and a row that ended accepts no candidate. Without the setting, a compaction of the live rows makes one host sync, and the reset draws only for the rows that end.
The rounds env (env_rounds.RoundsEnv) and the skill env (skills.env.SkillEnv) have no host sync in their step. This is also true with several vehicles in each scene and the kernel of agent rows. Tests/Fast/test_sync_free.py runs the steps with torch.cuda.set_sync_debug_mode("error"). The tests use the drive env (the banks all and mix6, and agent rows), the rounds env (P4 with 1, 2 and 3 vehicles, T4) and the skill env (the L1 bank of each skill, T5).
One part has host syncs: rule C's evasive exception of the drive env (evasive.py, a prototype of the simulator, on with rule_c=True, off with evasive=False). It finds the refused candidates with torch.nonzero and checks the rest of each in the PyTorch checker. Measured with the settings of training (128 rows, 8 candidates, 20 decisions): 3.2 to 3.7 host syncs for each decision on the banks mix6 and traffic. Without rule C, the decision has none. A fix needs the test recedes of the exception in a kernel (or the PyTorch checker on every candidate, which costs a second check of each decision). Until then, train without the exception or accept the syncs.
The settings of training against the old defaults (Results/Fast/robustness.json, 11 Nov 2026, before the switch: the test banks, the reference controller, 8 scenes each, 2 for the coverage skill). With ACRES_SYNC_FREE=1 and ACRES_BATCH_FUSED_AGENTS=1 some results stay the same, bit for bit (the event-log digest of each scene). These are P4 with 1 vehicle, T5, and the L1 checks of the ten skill banks. (The skill env does the physics of several rows in one physics step a launch, not in the kernel of agent rows. It does not read sync_free.)
These change: P4 with 2 and 3 vehicles and T4 (the kernel of agent rows: other draws of the noise and other float sums), and the drive env (the reset of sync_free draws for every row). The reference passes P4 with 2 vehicles in 7 of 8 scenes with both settings. It passes P4 with 3 vehicles in 6 of 8 (defaults) and 7 of 8 (training), and T4 in 7 of 8 and 8 of 8.
The mean least gap of T4 is 2.73 m with both. Eight scenes cannot show a difference of a few percent: the checks of 64 scenes must be made again with the new defaults.
The robustness pass recommended to make both settings the default at one time, before the first training run, with the settings of the vehicle side. It also recommended to make the reference checks again in the same change. This is done (Defaults of the Settings): the checks of 64 scenes with the new defaults are in Results/Benchmarks/defaults_switch.json.
The training code must also keep its own part of a decision free of host syncs:
- Do not read a GPU value on the host in a decision. Thus no
.item(),float(),int(),bool()orif t.any()of a tensor. - Do not index with a boolean mask, and do not use
nonzero. Usetorch.whereand masks of fixed size. - Make a tensor from a list one time, not in each decision (
view.const). - Read the results on the host at the end of a rollout, or every N decisions.
The Decision as a CUDA Graph#
At a small batch a decision is bound by the host. At 64 rows a drive decision launches about 3,700 kernels in 28 ms, and the GPU works for 6 ms of that time (18 Nov 2026, one L40S). A CUDA graph records the launches of one decision one time and then does them again with one call. Fast/acres_batch/graphs.py has the tool (DecisionGraph). A graph replay does the same kernels on the same memory, so the results are the bits of the eager decision.
What uses it. The loops of the gate runs (procedure.episode: P1, P2, P3 and refill, the P4 episode: P4 and T4, the skills episode: the 12 skills and T5), the drive evaluation (eval_drive.run), the drive trainer's rollout (grpo_drive.rollout) and the speed tool (bench --graph). A loop has two graphs: the decision and the step (the trainer: the decision with its step, and the next observation). The record of the commands, the probe of the events, the hooks, the end check and the trainer's refill stay eager between the replays.
How a graph is made. The first three calls run the decision eagerly. The Triton compiles, the caches and the first draw of the physics seed happen in them. The last of these calls measures what the decision changes on the host.
The fourth call records the decision (a capture runs nothing) and then replays it. After that each call is one replay. The tool walks the state of the roots of the loop (the environment, the solver or the planner, and their closures and objects).
The decision can replace a tensor with a new one (s["t"] = ...). At the end of the graph, the graph copies the new values back into the old tensor. Each replay reads and writes the same memory.
What a graph does not accept. The capture or the replay stops with CaptureError. The error message gives the cause and the path in the state. There is no silent change to the eager decision. These are the causes:
- A host sync in the decision (the environments with
sync_free: see Steps without a Host Sync). - A host number that the decision changes and a launch reads, because the graph replays the value of the capture. The physics seed is a counter on the GPU for this reason (a
[1]int64 tensor that the kernel reads: the same draws as the host count of before). A loop names the host counters that no launch reads (the state version_svof the visibility cache). - A tensor of the state that changes its shape, a new key, or a list that grows.
- Code between the replays that replaces a tensor of the state.
adopt()copies the new values into the graph's tensors after such code (the trainer's refill resets rows with an index). Other changes to host values between the replays stop the next replay.
Solvers on the host. Some baselines solve on the CPU in a decision: the MILP planner of P2 (baselines/harvest.Planner), the CP-SAT baseline of P1 (scenarios_hay.CPSAT) and the VRPTW of P4 (baselines/vrptw.VRPTW). A graph cannot replay such a solve. These classes set GRAPH = False, and graphs.decision then gives the eager decision for each loop that has one of them as a root. The other loops of the same run still use graphs.
An environment does the same when its step makes a host sync: Env.GRAPH is false without sync_free. The drive environment's is also false with rule C's evasive exception (evasive.apply).
Eager mode. ACRES_BATCH_GRAPH=0, a machine without CUDA, or an environment on the CPU gives the eager decision. This is plain PyTorch with the same calls (graphs.Eager), and it works on any device. The eager decision is the specification. The verifier of each gate task runs every log again eagerly and compares the state digests. Each gate run also compares the graph with the eager decision.
Checks. Tests/Fast/test_graphs.py runs 40 drive decisions (rows that end and restart in them) eagerly and as a graph, with 1 and 2 agents a scene. Every tensor of the environment and of the proposer is bit-equal. The test also checks that each misuse stops with an error. The evaluation's result file and the gate tasks' result files are equal with and without the graph.
Speed. One L40S (oats5), the drive decision (bench.decision, 32 candidates): 64 rows 28.7 ms eager, 5.1 ms graph (5.6 times). 256 rows 28.9 and 9.0 ms. 1,024 rows 28.6 and 15.3 ms. 4,096 rows 51.8 and 29.4 ms. The drive evaluation (64 scenes): 12 s to 3 s for the loop.
The skill dock (16 scenes): 21.7 s to 3.4 s with the do-nothing controller, 11.0 s to 1.9 s with the reference. Refill with two vehicles (8 scenes): 53.9 s to 12.6 s and 26.7 s to 4.2 s. The capture costs about one decision, and each new environment of a run makes its own graph.
One RTX 5060 Ti (zuzu), the same decision: 64 rows 14.5 ms eager, 5.0 ms graph (2.9 times). 1,024 rows 26.2 and 22.2 ms. 4,096 rows 79.7 and 78.6 ms (at this size the GPU work is the bound, not the host). The drive evaluation (128 episodes): 18 s to 10 s, the same results. The quick gate (34 jobs, 6 at a time, commit cb61103): 66 minutes.
Each result file is equal to the committed one but for the speed fields. The P1 and P3 jobs are most of that time: their step is the cost (gaps.md A), not the decision.
Code Loading, Threads and Module State#
A search of the Python code that the simulator and the benchmark run (Fast/, Map/, Tools/, 11 Nov 2026) was done.
It found no importlib.reload, no file watcher, no asyncio and no thread in a step. The files of Config/ are read one
time (follow.vehicle_law, vehicle.node_gear_params, env_drive.vehicle_holds, world.py at its import) or when
an environment is made (vehicle.load). These remain:
| Item | Where | Why It Stays |
|---|---|---|
multiprocessing.Pool |
the bank builders (bank.py, scenarios_*.py) |
Offline, before a run: Pool.map keeps the order of the scenes and each scene has its own seed. |
ThreadPoolExecutor |
acres_fleet/maps.py |
The run-time library loads its maps. Not the batched simulator. |
| Threads | Tools/Performance/*.py, Tools/SimControl/*.py |
Watchers of the game's speed and of its link. Not the batched simulator. |
| The process default of the fast paths | fast.enable |
Read only when an environment is made (Fast Paths). |
chunk.N_MAX, chunk.V_FWD |
env_drive.use_chunks |
The longest chunk and the top speed of the chunk maker for the whole process. A program sets them one time at its start. The test files put them back (conftest.py). The chunk kernel, the follower, the reference drive and the skills read them: a value for each environment is a change of all of these. |
| Triton's coalesce pass | kernels/physics.py, _fast_compile |
Left out while the physics kernel compiles, and put back after it. The results are the same. |
| The forms of the physics kernel | kernels/physics.py, NOT_SPECIALIZED |
Triton makes a form of a kernel for each value of its constants and for an integer argument of 1 or a multiple of 16. Each form of the physics kernel is a compile of 25 to 60 s (oats5). Since 18 Nov 2026 two arguments make no form: the first step of a launch (phase, 0 to 9) and the contact slots of the skill env. Thus the launches of one step have one form for each setting, not three. steps and shield_every stay: the form for 1 has no loop and is faster. The results are the same. |
| The bank caches | skills/bank.py (lru_cache), scenarios_delivery.py |
Caches of values that do not change. |
ACRES_SIM_STRICT (a check of the indices of the fused checker, with a host sync) is read at each call of
kernels/check.check. Tests/Fast/agreement/test_sim_check.py sets it while it runs. Read it one time at the import when
that test sets the module's value.
A callback of a run does not change its control flow. p4/run.episode(hook=...) gives each decision to the learner's
record. eventlog.Log.close(..., state) makes the state digest only at its fixed decisions.
Gearbox#
The setting Env.gearbox selects the gear logic between the path follower and the vehicle:
| Value | Gear Logic |
|---|---|
batched |
The old default. The vehicle shifts when the speed command is against its gear and the vehicle is slower than 0.3 m/s. |
vehicle |
The default since 11 Nov 2026. The launch hold and the gear logic of the vehicle software (vehicle.node_gear, a port of Vehicle/Runtime/Source/command_chain.cpp). |
The environment variable ACRES_GEARBOX sets the default of a process when it starts (ACRES_GEARBOX=batched: the old default). An environment can set its own value before its first step.
With vehicle, the node runs one control step of 0.1 s at each second physics step:
- The launch hold keeps the largest speed command while the vehicle is at rest.
- A command against the gear of the node is a stop. The node shifts when the vehicle is slower than 0.1 m/s.
- After a shift, the speed command is 0 for 1.1 s.
- The vehicle gets the gear of the node as a request. It shifts with its own shift time and speed limit.
The state key node [B, 4] holds the gear of the node and the control steps left of its hold. It also holds the held launch speed and the speed command of the control step. The PyTorch paths and the physics kernel read and write this key. A reset and the agent rows keep it for each row. With batched, the state has no key node, and each result is the same as before, bit for bit.
Agent Rows#
The module Fast/acres_batch/agents.py puts more than one controlled vehicle (agent) in one scene. env.Env and env_drive.DriveEnv take these arguments:
| Argument | Meaning |
|---|---|
agents |
The number of agents A in each scene, 1 to 4. The default is 1. |
groups |
The scenes: a list of G rows of A bank rows. Each bank row of a group is one agent. -1 means that the scene has no agent at that place. |
scenes |
A bank as a dictionary of arrays. The environment uses it in place of a bank file. |
The environment has B = E x A rows. Row e x A + a is agent a of environment e. Each row is one vehicle, as before. The agents of a scene have the same corridor, discs, things and actor paths, and each agent has its own start and route.
How the agents see each other:
- The other agents of a scene are peer things. The things of a row have A - 1 more slots, after the slots of the scene. A peer slot is a vehicle with the body box, the heading of travel and the speed of the agent.
- In the drive and delivery-rounds environments each peer has the box of the Polaris. In the skill environment each peer has two slots: one for the vehicle with its loader and its mounted tool, and one for its trailer. Thus the things of a row have 2 (A - 1) more slots there. The boxes come from
vehicle.peer_table. Each box is the envelope of the boxes that the checker uses for the same vehicle. A peer box is not smaller than the body. Example: a loader tractor is a box of 6.4 m by 2.6 m. The round baler adds a trailer box of 4.8 m by 3.2 m.Tests/Fast/agreement/test_peer_bodies.pycompares the kernel with the PyTorch path on the harvest and hay tasks. - The environment writes the peer slots at the reset and after each physics step, before the contact test. Thus the agents move in the same physics step.
- The peers go into the LiDAR scan, the contact test, the observation, the tracks and rule C of the checker.
- The scene moves its people and vehicles in each row against the row's vehicle. Each actor takes the move against the live agent whose body is nearest to it (
agents.ego_agents,agents.from_egos. At equal distances: the lower agent). The other rows copy the things of the scene from the row of agent 0. Before 18 Nov 2026 the actors reacted to agent 0 only. An environment whose things do not move (the rounds and the skill environments) keeps agent 0.
The episode of an environment:
- An agent that gets to the end of its route is finished. It stops and it stays a peer.
- The environment ends when all its agents are finished, or when one agent fails. All the rows of the environment end together and start again together.
- The deadlock detector makes a wait-for graph at each decision. Agent a waits for agent b when a is slow, has no route progress for 3 s, and b is near in front of a. A cycle in the graph for 5 s is a deadlock. The step gives the event in
info["deadlock"].
With one agent in each scene, the results are the same as before, bit for bit.
from acres_batch import agents, env
scenes, groups = agents.meeting(passing=True) # two agents head-on on a single track
e = env.Env(2048, agents=2, scenes=scenes, groups=groups)
reward, done, info = e.step(action) # action [4096, 5]: one row for each agent
The physics kernel of agent rows does the physics of several agents in one launch. It has one program for each environment, with a loop over its agents. Since 11 Nov 2026 the paths of fast.choose() have it by default. Turn it off with fast.choose(agents=False) or with the environment variable ACRES_BATCH_FUSED_AGENTS=0: two agents in one scene then use the PyTorch physics (the old default). fast.TORCH has the PyTorch physics always:
A decision of the skill environment with no work between the physics steps. The environment packs its state one time. It then launches the physics kernel one time for each of the ten physics steps, with no other work between the launches.
The kernel has the contact test of the skill environment (the boxes of the vehicle, its tools, the item that it carries and its trailer) and writes the pose, the speed and the time of each step to a record. An item that another vehicle carries moves with that vehicle at each step in the kernel. The harvester does not depend on the vehicles within a decision. The code does its ten steps before the launches.
The kernel puts its body at the pose of each step. The work of the implements (the sprayer, the mower, the cutter, the baler) then runs on the record. One step a launch, not one launch of ten steps: Triton makes a kernel with no loop over the steps when the count is 1. That kernel is faster for each step (hay at 2,048 scenes: 15.7 ms for ten launches, 28.5 ms for one launch of ten steps). Before, the contact test and the work ran in PyTorch between the launches.
That form stays as the specification. Tests/Fast/agreement/test_one_launch.py compares the two forms on spray, refill, mow, mow on a lane, hay, harvest, take, carry and place. Every tensor of the state is equal. Turn it off with ACRES_BATCH_FUSED_WORK=0.
The limits of each vehicle. The checker, the plan maker and the shield use the limits of each row's vehicle with its implement and its load (vehicle.limits_of, vehicle.SPEED_CAPS, decision of 14 Nov 2026). The Polaris keeps its limits. For a tractor, the emergency brake is the grip of the tractor's wheels (0.5, assumed) times g times a mass ratio, at most 3.5 m/s2. The ratio is the tractor's mass over the mass of the tractor with what it carries and tows.
No implement has brakes (assumed). A plan stops with 0.8 m/s2 or with half of the emergency brake, the smaller.
The lateral acceleration is 1.5 m/s2. It is 1.0 with a bale on the loader, with the wings of the cutter raised and with a full grain cart. A full grain cart: 0.84 m/s2 and 0.42 m/s2. The speed caps are the work speeds of the scenes and assumed caps for transport. The values are not measured on the tractor. ACRES_TRACTOR_LIMITS=0 gives every row the limits of the Polaris.
On the 64 test scenes with the limits (the result files of commit e892971), hay passes 57 with one vehicle and 54 with two, as before. 4 and 2 scenes end in another way. Harvest passes 62 and 62 as before, with the mean makespan about 1 % longer. The operator rule with one cart passes 56 (55 before). Spray, refill and the 12 skills give the same counts. Each log repeats from its commands.
The judge and the observation through torch.compile. fast.choose(compile_judge=True, compile_obs=True) (or ACRES_BATCH_COMPILE_JUDGE=1 for the judge) compiles the judge's step and the observation of the drive environment one time for a batch size. It is the same code: no second form. One L40S: the judge 9.8 ms to 0.7 ms at 1,024 rows and 10.1 ms to 1.5 ms at 16,384 rows (19 s to compile). In 30 decisions no boolean or integer result differs, and the floats agree within 1.5e-5. The default mode of torch.compile is used: reduce-overhead is slower at 16,384 rows and max-autotune compiles three times longer for the same speed.
A drive decision with two vehicles a scene, with the judge and the observation compiled, gives 35,000 to 49,800 agent-decisions per second at 1,024 rows. At 16,384 rows it gives 334,000 to 416,000. Off by default (the tests and the checks). The trainer of FARMS turns it on.
The baler's kernel. With the record of the steps, one kernel does the baler's work of a decision (kernels/baler.py). It has one program for each scene and a loop over the physics steps. Each step has the pickup of the windrow segments, the bale at the end of a wrap, and the segments lost under the tyres.
The PyTorch forms (items.pickup, items.form, items.run_over) stay as the specification. Tests/Fast/agreement/test_baler.py compares them on the hay task: the states of the segments, the items and the baler are equal. The water of the chamber differs by the rounding of a sum (0.000008 kg in 600 decisions).
Turn it off with ACRES_BATCH_FUSED_BALER=0. Measured on one L40S at 4,096 scenes with the two changes: refill with two vehicles 131,700 to 163,300 agent-decisions per second, spray 51,300 to 57,000. Hay with two vehicles at 2,048 scenes: 27,300 to 38,700 (the baler's work in a decision: 64 ms to 8 ms).
The environment alone and with the reference solver. A decision of a run with the reference solver has two parts. The first is the solver with the skill controller, which checks 18 candidate paths for each vehicle. The second is the step of the environment.
A trained policy replaces the first part. Fast/Tools/env_only_speed.py times the two parts apart (Results/Benchmarks/env_only_speed.json, 14 Nov 2026, one L40S, a sync of the GPU after each part). Spray at 4,096 scenes: 123,300 agent-decisions per second for the environment alone and 67,900 with the reference solver.
Refill with two vehicles at 4,096 scenes: 453,000 and 161,400. Hay with two vehicles at 2,048 scenes: 61,800 and 35,600. Harvest with two carts at 2,048 scenes: 91,900 and 48,400. In each case a second environment that takes the same commands ends with the same vehicles.
The place of a scene in the batch. Tests/Fast/test_layout.py runs 8 scenes of spray, refill, hay and harvest two times: in their order, and in another order in a batch of 11 scenes. Each scene has the same vehicles, distances, shield cuts and contacts, bit for bit, with the noise on.
The key of the noise. The physics kernel draws the speed noise of the things and the range noise of the scan from Philox. The key of a draw has the seed of the decision and the noise key of the row (fast.noise_key, the state key nkey of the kernel). The noise key is the scene times 4 plus the agent of the row.
The scene is its bank row in the drive env (bank_index), else the first 28 bits of the sha256 of the scene's arrays (env_routes.RouteEnv.set_scene_keys). The counter of a draw is the physics step and the thing or the beam. Thus the draws of a scene do not depend on its row.
The things and the scan have separate streams (before, the scan of one step and the things of the next step had the same key). Before 18 Nov 2026 the counter had the index of the row, and the draws changed when a scene moved to another row. The torch forms (world.step, world.scan) still draw from the generator of the env, in the order of the rows.
The coarse grid of the checker's scene kernel. The rules obstacle and corridor test a grid of cover discs on each box of the body at each point of a trajectory. The tractor with the boom of the sprayer has 654 cover discs at a point. The scene kernel first tests a coarse grid on the same boxes, with an eighth of the discs each way. A cover disc is at most half the diagonal of a coarse cell from the centre of its cell. The distance to an obstacle and the room in the corridor change by at most the distance moved.
A coarse centre can have the need of a cover disc, plus this distance, plus 2 mm for the rounding. Then each cover disc is clear, and the kernel does not test the cover discs of that block of points.
Where a point fails the coarse test, the kernel tests the cover discs as before. The verdicts do not change: the tests of the checker pass, and the spray check gives the same result in each scene. Measured on one L40S: the checker in a spray decision at 4,096 scenes 34.5 ms to 11.9 ms. Spray 57,000 to 80,800 agent-decisions per second (61,800 to 93,700 at 16,384 scenes). Refill with two vehicles 163,300 to 192,900.
- At each physics step, the kernel moves each agent and then the things of the scene. Then it tests the contact and the shield of each agent.
- The things of the scene react to the agent nearest to each of them, as in the PyTorch path (the constant
EGOSof_agents_kernel: one step of the things against each agent, with the peers of that agent in the slots). The other agents are in their peer slots with their speeds. - The traffic model runs with agent rows only in this kernel. Its meeting, pull-out and passing rules are for the nearest agent of each vehicle. Its car following sees each agent.
Tests/Fast/agreement/test_agents_physics.pycompares the kernel with the PyTorch path on scenes with two people, one by each agent. The PyTorch path has no traffic model: an environment whose agent 1 is absent gives the bits of the kernel of one vehicle. - The rounds env launches the kernel once for each decision.
Tests/Fast/agreement/test_agents_physics.py compares the kernel with the PyTorch physics of agent rows.
Field Grids#
The module Fast/acres_batch/fields.py keeps the field grids of the procedure tier (work package WP5 of the benchmark design). The PyTorch code in the module is the reference. The module kernels/stamp.py does the same work in two Triton kernels. On a GPU, stamp_sections and stamp_tyres use the kernels.
Each scene has up to 4 field windows of 256 m x 256 m. Each window has these grids:
| Grid | Cell | Content |
|---|---|---|
cover |
0.5 m | Three bit planes: worked, worked two or more times, forbidden (for example a no-spray zone). The scene writes the forbidden plane. |
rut_mm |
1 m | The rut depth in mm: the deepest rut of the 16 cells of 25 cm in the cell. |
track |
1 m | The tyre passes (bits 0-15) and the cells of 25 cm with a rut (bits 16-31). |
A row (one vehicle) writes into the windows of its scene (env_of). Thus many agents of one scene can write the same grids. All writes are integer OR, MAX and ADD. The result does not change with the order of the rows.
Call the two stamps at each physics step:
stamp_sections: give the tool line before and after the step (a point and the travel heading). Also give the lateral extent of the tool and the mask of the live sections. A cell is worked when the swept area of a live section covers the cell centre.stamp_tyres: give the footprint of each tyre (centre, heading, width, length) and its sinkage. The rut of each 25 cm cell below the footprint becomes 65 % of the sinkage (at most 0.35 m), as in Core.tyre_footprintsmakes the footprints from the contact points.
To read the grids, use areas (worked, overlap and forbidden area of each scene), rut_volume, compacted_area and at (the rut and the passes at points).
Run the tests and the speed measurement:
python -m pytest Tests/Fast/test_fields.py -q # unit tests (GPU)
python -m pytest Tests/Fast/test_fields.py -q -m integration # against Core (needs Game/Core/Build)
python Fast/Tools/fields_speed.py --json Results/Fast/fields_stamp.json
The rule for worked cells is not the rule of Core. Core marks each 25 cm cell that a strip touches. Thus Core gives about one cell more across each pass. The benchmark design (section 7.6, WP5) gives the reason and the measured difference.
Long Routes#
The module Fast/acres_batch/lanes.py gives routes that are longer than one scene of a bank (work package WP2 of the benchmark design). A route can go between fields, for example 3 km or more. The checker, the follower and the observation read only a window of 64 capsules and 256 route points. The module makes this window for each row at each decision.
A scene has these parts:
| Part | Content |
|---|---|
| Lane graph | Nodes and edges. Each edge is a lane with points at 1 m, a corridor half width, a road half width and the class beside the road. |
| Capsule pool | Up to 2,048 capsules: the chain of each route and the chains of the edges that no route uses. |
| Route table | Up to 16 routes of the scene, with points at 1 m. Each route has a relevance list: the pool capsules near the route, with the route arcs where they are near. |
Make a lane graph from one of these sources:
| Source | Function |
|---|---|
| The lanes of the ACRE map | Graph.from_farm(). Use subgraph to cut the region of a scene. |
The delivery paths of scenarios_delivery.py |
Graph.from_paths(records). Each path is a one-way edge with its own chain. Use subgraph(edges, stub_m=0) and pack(..., route_chains=False). |
| A procedural farm | Graph.procedural(rng): a grid of lanes with loops, field entries and a yard. |
A route is a list of legs (edge, direction). Graph.walk makes a random route. Graph.shortest makes the shortest route between two nodes. pack makes the arrays of one scene. stack puts the scenes on the GPU.
A row has its scene (env_of), its route (route_id) and its progress in metres along the route. Many rows can use one scene. lanes.window (PyTorch) and kernels/lanes.window (one Triton kernel, the same result) give for each row:
- The capsules that are near the route from 40 m behind the progress to 50 m ahead.
- 256 route points from 16 m behind the progress, and their gear, road half width, road class and class beside the road.
start: the route index of the first point of the window. The progress in the window isprogress - start.overandvalid_to: the window has more than 64 near capsules. It is then correct only to the route arcvalid_to.
The window does not cause a host sync.
import numpy as np
import torch
from acres_batch import lanes
from acres_batch.kernels import lanes as lanes_kernel
rng = np.random.default_rng(0)
g = lanes.Graph.procedural(rng)
scene = lanes.pack(g, [g.walk(rng, 3000), g.walk(rng, 3000)]) # two routes of 3 km
L = lanes.stack([scene] * 2048) # 2,048 scenes
env_of = torch.arange(2048, device="cuda").repeat_interleave(2) # 2 agents in each scene
route_id = torch.arange(2, device="cuda").repeat(2048)
progress = torch.zeros(4096, device="cuda") # m along the route
w = lanes_kernel.window(L, env_of, route_id, progress)
w["scene_caps"], w["route"] # [4096, 64, 5], [4096, 256, 2]
Run the tests:
The test compares the checker verdicts of the window with a hand cut and with the whole pool. It uses 1,000 poses of a route of 3 km. A chunk that turns into a road beside the route can get a refusal that the pool does not give.
Weather and Soil Water#
The module Fast/acres_batch/weather.py gives the weather and the soil water of the procedure tier (work package WP7).
Weather. Record reads the frozen record of the Purdue Mesonet station at ACRE one time. Record.bank(rng, E, split) gives E series of 12 h in steps of 10 minutes, [E, 72, 4]:
| Column | Content |
|---|---|
| Rain | mm/h. The rain of the 30-minute interval of the record. |
| Potential evaporation | mm/day. The value of the day, spread over the day by the solar radiation. |
| Wind | m/s. The mean of one of 33 days of the station, with a variation in steps of 10 minutes. The variation is not measured. |
| Wind direction | rad, the direction the wind comes from. |
The split train uses the record of 2024. The split test uses the record of 2025. at(weather, t) gives the row of each scene at its farm time.
Soil water. Each field has two soil layers and a pond, as a soil-water column of ACRES Core. soil_start makes the state from the texture class, the cover (sealed or open), the detention depth and the start fraction. soil_step advances the fields by one step of 10 minutes. Give a mask of the scenes whose farm clock passes a step.
saturation gives the effective saturation of the surface layer. residual gives the error of the water balance.
The parameters are in Fast/acres_batch/weather_fit.json. The command below fits them to the columns of ACRES Core again. It needs the module acres_core (Game/Core/Build, or the folder in ACRES_CORE_BUILD).
Cut hay. Record.curing gives the weather that cut hay cures under, for the window of a series. This weather is the solar radiation, the air temperature, the relative humidity and the soil moisture of the station.
The field-curing model is in Fast/acres_batch/curing.py. step moves the moisture of the hay of each field by one of three laws (drying in the sun, dew in the night, uptake of rain). cure gives the moisture from the time since the cutting. P1, section 3.1, gives the equations, their sources and what is assumed.
Run the tests:
Vehicle Kinds and Bodies#
The module Fast/acres_batch/vehicle.py has a parameter table for each vehicle kind (work package WP4 of the benchmark design). The module check.py checks each row with the boxes of its own body.
Kinds. vehicle.kinds() gives a Kinds table. Each entry is a Params of one kind:
| Kind | Index | Source of the Parameters |
|---|---|---|
polaris |
0 | vehicle.load(): the fit to the drives of the Polaris. |
maxxum |
1 | vehicle.maxxum(): the geometry of tractor.json. The setting tractor core gives the speed loop, the steering map and the mass fitted to the Maxxum of ACRES Core (vehicle.MAXXUM_FIT). Else it has the assumed values of before. |
maxxum_loader |
2 | The Maxxum with the front loader and the bale fork: the mass of the loader (820 kg: its subframe, boom and carrier). |
The Maxxum's fit to Core (12 Nov 2026, the setting tractor, core, the default, ACRES_TRACTOR=assumed gives the engineering estimates of before, see Defaults of the Settings). The tractor of the game has pedals and 16 gears and no speed controller. Fast/Tools/tractor_core.py drives Core's Maxxum with the game's own speed driver (AcresVehicle.cpp, DriveReviewRoute). (This driver has the throttle 0.7 per m/s of error and the brake 0.5 per m/s. It shifts up above 1900 rpm and down below 1050 rpm once a second.) with an integral of the speed error on the throttle. The integral is an assumption: the game's driver alone settles 15 % to 40 % below its command. Fast/Tools/tractor_fit.py fits the fast model to Core on firm silt loam (Results/Fast/tractor_fit.json):
- The steering. The tyres turn 0.96 of the road-wheel angle (the median at 0.05 to 0.2 1/m and 1 to 5 m/s,
firmware_ratio). At the full lock Core's tractor drives 0.256 1/m, not the kinematic 0.296 1/m. The smallest turn has a radius of 3.9 m in place of 3.4 m (lock_deg34.0,max_curvature). The lag of the steering is 0.57 s in place of 0.30 s (the delay, the lag and the tyres' relaxation as one lag). - The speed loop. Least squares of the speed on straight drives of 40 s of seven trains together. The trains are the tractor, the sprayer with a full tank, the loader with a bale and the round baler. They also include the grain cart empty, with 10 t and full (5.8 t to 28 t). A load lowers the limits of the acceleration and the deceleration by mass / (mass + payload). The mass is that of the kind (5,820 kg, 6,640 kg with the loader). The payload is the rest of the train (the implement on the chassis or trailed, and its load).
The model stays kinematic. A full grain cart (21.6 t of grain on a 6.6 t Kinze 851 behind the 5.8 t tractor) reaches 2.5 m/s at most on firm silt loam. The engine's force in gear 10 equals the train's resistance there. The fast model has no such limit in its speed loop: the ground tables give it (ground_ratio).
Give the table and the kind [B] of each row in place of a Params:
from acres_batch import vehicle
kinds = vehicle.kinds()
s = vehicle.start(x, y, yaw, v, k, kinds, kind)
s = vehicle.step(s, curvature, speed, kinds, 0.05, kind, payload) # payload [B] in kg, or None
The functions start, step, curvature_of, reached_curvature, wheel_of and command_wheel take a table. Each kind uses the arithmetic of its own Params. Thus a Polaris row has the same bits as in a batch of Polaris rows only.
The combine. The kind combine (since 19 November 2026) is the Case IH Axial-Flow 7250 of Game/Content/Simulation/combine.json. The file gives a source or the mark ASSUMED for each value. The reference point is the front axle, the fixed axle.
The rear axle steers. The body has two boxes: the machine (6.15 m behind the axle, 1.9 m ahead, 3.73 m wide) and the header (9.15 m wide, 3.7 m ahead of the axle). The speed cap is 25 km/h, the maker's value. The steering lag and the speed loop are the estimates of the Maxxum: there is no fit. The scripted harvester of the harvest tasks (harvester.py) does not use this kind.
Payload. A payload in kg makes the acceleration limit and the deceleration limit smaller by the factor mass / (mass + payload). A payload of 0 gives the same numbers as no payload.
Trailer. vehicle.tow moves a trailer after each physics step. The trailer axle moves toward the hitch pin and keeps its distance from the pin. This is the equation of the game (StepImplementPhysics, the square baler). The function does the equation 4 times in each step of 0.05 s.
Physics kernel. kernels/physics.py reads the parameters of each row from the table. Give the table as p and these optional keys of the state:
| Key | Shape | Content |
|---|---|---|
kind |
[B] int32 |
Each row's kind. If the key is not there, all rows are kind 0. |
tow |
[B, 3] |
The hitch pin ahead of the rear axle (m, negative behind), the distance from the pin to the trailer axle (0: no trailer), the trailer heading (rad). The kernel changes the heading. |
payload |
[B] |
The payload in kg. |
Bodies. vehicle.body(kind, implement, trailer_yaw) gives a check.Body. A body has 5 box slots: the vehicle, a front tool, a rear tool and two boxes of a trailer. The implements are in vehicle.IMPLEMENT_NAMES. Give the body to check.check(..., body=body) or to the kernel checker. For the kernel, the body has one row for each environment, as the scene.
The checker uses each box of a body:
- A box of the vehicle frame is a plan box of the Lean model, with its own size and its own disc cover. The box includes the rear axle. The rule
curvaturekeeps the turn small for each box. - A box of the trailer is on the path of the trailer along the chunk. The checker calculates this path with the equation of the game. Each box of a point is larger by the movement of the trailer to the next point and by a margin of 0.05 m. The Lean model does not have trailer boxes. A test examines them. There is no proof.
- Backward with a trailer (since 18 November 2026): the hitch pin is on the tangent of the path at each point (
check.back_axes). The trailer is the exact solution of the model with no side slip (vehicle.trail). The boxes of the trailer are larger by 0.1 m. The ruledirectionapplies rule R8 of the shield (Config/shield_tractor.json). The hitch angle must be valid. The backward speed is 1.0 m/s or less. The hitch angle is 15° or less at each point. - Backward, the path of the trailer is not stable. The forward equation of the game gave an error of 0.19 m against a vehicle that reverses on arcs through the points. The exact solution gives 0.036 m (
Tests/Fast/test_check_kinds.py). - A box of the trailer can have a place beside the axis of the trailer (
vehicle.TRAILER_SIDES, the sixth value of the box, since 19 November 2026). The mower-conditioner with its header on one side (mower_left,mower_right) and the rotary cutter with one wing raised (cutter_left_raised,cutter_right_raised) have such a box. The skill environment selects these states from the swing of the tongue and from the wings (skills/work.py). The contact test of the skill environment uses the same place. The peers and the contact test ofenv.Envuse the envelope of the two sides. - The checker refuses a point when one of its boxes breaks a rule.
The body of the Polaris is the plan box of the limits. It gives the same verdicts as no body. The sizes of the Maxxum and of the implements are estimates from tractor.json and Game/Content/Simulation/implements/*.json. They are not measured.
Bodies in the physics. The setting Env.bodies selects the body of the contact test and of the shield in the physics (the PyTorch paths and the kernels). The environment variable ACRES_BODIES sets the default of a process:
| Value | Body |
|---|---|
polaris |
The old default. The plan box of the limits for each row. |
rows |
The default since 11 Nov 2026. The body of each row (the state key body, a check.Body). The contact tests each box of the body. The boxes of a trailer are at the axle of the trailer. The shield tests the boxes of the vehicle frame. |
What the proofs cover for a body. The Lean model of the checker (Vehicle/Proofs/AcresVerification/Trajectory/Model.lean, Limits) has one box as parameters. These are the box's length behind and ahead of the rear axle, its half width and cover counts, and the speed and braking limits.
Thus the theorems hold for a vehicle that is one box with its own limits, for example the tractor alone. The compiled checker does not change for it. The theorems do not cover a body of several boxes (a loader, a boom) or a trailer that turns on its hitch. The fast simulator tests each of these boxes with the same rules. This is not proved (decision of 14 Nov 2026: the proofs for several boxes and a trailer are later work).
The shield does not test the boxes of a trailer. The checker tests them at each decision, on the path of the trailer. The peer slots of the skill environment have the boxes of each peer's vehicle and trailer (vehicle.peer_table). The drive and delivery-rounds environments keep the box of the Polaris. Tests/Fast/test_bodies_physics.py compares the kernel with the PyTorch path for mixed kinds, implements and trailers.
Ground Surrogate#
The module Fast/acres_batch/ground.py gives the slip, the sinkage and the fuel of the Polaris on soil and on hard ground (work package WP6 of the benchmark design). The kinematic vehicle has no tyres. The module gets the values from tables of ACRES Core runs.
The tool Fast/Tools/ground_tables.cpp makes the tables. It runs the Polaris of ACRES Core on flat ground to a steady state, for each point of a grid. The axes of the grid are the ground, the water content, the surface wetness, the wheel speed, the pull and the cargo. It writes Fast/acres_batch/data/ground_tables.npz.
Game/Core/build.sh # the Core library (Game/Core/Build/libacres_core_static.a)
BUILD_DIR=/tmp/ground Fast/Tools/build.sh
/tmp/ground/ground_tables . Fast/acres_batch/data/ground_tables.npz --threads 8
Use the module at each physics step:
loadreads the tables one time.pull_ratiogives the pull of an acceleration, a grade, a drawbar and standing water.lookupgives these quantities for each row: speed loss, rear slip and driven slip. It also gives the sinkage of the front and rear wheels and the fuel rate.ground_speedgives the ground speed from the wheel speed.tyre_sinkagegives the sinkage forfields.stamp_tyres.fuel_lgives the fuel of the step.stuck_stepis the stuck rule of the run-time library (slip above 0.4, slower than 0.3 m/s, for 3 s). The states are FREE, SLIPPING and STUCK.
The tables are the model of ACRES Core. They are not measurements. The tyre slip of the model is about half of the ASABE D497.7 value. No field measurement of the slip of the Polaris exists.
Run the tests and the comparison with Core:
python -m pytest Tests/Fast/test_ground.py -q # unit tests
python -m pytest Tests/Fast/test_ground.py -q -m integration # against Core (needs Game/Core/Build)
python Fast/Tools/ground_check.py --json Results/Fast/ground_surrogate.json
The Maxxum's Ground Tables#
ground.load_tractor reads the tables of the Maxxum and its implements (Fast/acres_batch/data/ground_tables_maxxum.npz, 2.5 MB). The tool Fast/Tools/tractor_tables.py makes them from the steady state of Core's tractor train on a test-stand ground (TractorBatch.set_ground), in about 30 minutes on 14 threads:
PYTHONPATH=Fast:Benchmark:Vehicle python Fast/Tools/tractor_tables.py Fast/acres_batch/data/ground_tables_maxxum.npz --threads 12
| Axis | Nodes |
|---|---|
Train (ground.TRAINS) |
The tractor alone. The mounted sprayer at work (lowered, the PTO and the valves on). The loader with the bale fork. The round baler at work (the pickup down, the PTO on, a windrow of 3 kg/m) and in transport. The grain cart |
| Ground | Field soil (the class's firm density) on silt loam, silty clay loam and sandy loam. Sod on silt loam. Gravel |
| Water | The effective saturation 0.3, 0.5, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0 (not theta: the classes saturate at different contents, ground.saturation converts) |
| Speed | 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6.5, 8 m/s (the commanded ground speed) |
| Pull | 0, 0.05, 0.15 of the train's weight (a drawbar at the hitch: a grade, an acceleration) |
| Load | 0, 0.278 (6 t of grain), 0.4, 0.5, 0.75, 1 of the capacity: the sprayer's 800 L, the bale on the fork, the cart's 21.6 t of grain |
Each run starts at rest and lasts 24 s under the speed driver (Vehicle Kinds and Bodies). The values are the means of the last 4 s. A train with the PTO on drives in the gear of its speed at the PTO's engine speed. The hand throttle holds the speed. The PTO turns within the gear's step of 540 rpm.
The quantities are those of the Polaris's tables and these more:
draft_n: the implement's draft on the tractor (the soil and rolling draft of the implement model, a trailer's drawbar load).pto_kw.stuck: 1 where Core's steady state is stuck by the run-time library's rule. The meta has the fuel at rest (idle, and the cart's auger unloading).
Use:
from acres_batch import ground as G
t = G.load_tractor()
train = G.train_index(vehicle.KIND_NAMES, vehicle.IMPLEMENT_NAMES)[kind, implement] # -1: no train
train = G.at_work(train, baler_working) # the baler's pickup and PTO
q = G.tractor_lookup(t, train, ground, theta, speed, G.tractor_pull_ratio(t, train, load, accel=a), load)
v_ground = speed * q["ground_ratio"] # the speed loss, and the train's largest speed
fuel = G.fuel_l(q, dt) # with the PTO load
The stuck rule of the tables is tractor_stuck_step. It takes the outcome of the nearer nodes (q["stuck"] at least 0.5), not the rule on the interpolated slip and speed (a blend of a stuck node and a rolling one is neither). It gives Core's outcome on wet ground (test_ground_maxxum.py: 140 cases, 0 differ). Under the speed driver, the tractor rolls on saturated silt loam and silty clay loam. This is so alone, with the round baler, and with the grain cart empty or with 6 t of grain.
The full cart is stuck from Se 0.8 on silt loam and from Se 0.85 on silty clay loam. (The audit's drive, full throttle in gear 7 from rest, gets the 6 t cart stuck at saturation: the speed driver starts in gear 5.) The tillage implements have no table (no task tills).
Delivery Rounds#
The modules below make the benchmark task P4, delivery rounds with time windows (work package WP3 of the benchmark design). The task page is P4: Delivery Rounds with Time Windows.
| Module | Content |
|---|---|
scenarios_rounds.py |
The scenes: the yard of a map, 2 to 8 delivery spots, 3 to 8 requests with release times, time windows and service times. The single-track zones of the routes. The meeting scenes of T4. |
env_rounds.py |
RoundsEnv: 1 to 3 vehicles in each scene (the agent rows). The round of a vehicle, the life of a request and the episode of a scene are state machines (round_step, request_step, episode_step). |
meeting.py |
The meeting rule: each single-track zone is for one direction at a time. |
verify_rounds.py |
The verifier. It reads only the episode log. |
eventlog.py |
The event log of every task and its digest (WP12): actions, events and state digests in fixed-size tensors, one record for each scene at the end. The page is Event Log and Verifier. |
baselines/drive.py |
The reference drive, the drive of an observation (PolicyDrive) and the drive that stands (STAND). |
baselines/vrptw.py |
The VRPTW solver of the classical baseline (OR-Tools). |
RoundsEnv.step(choice, drive) takes two actions at each decision:
choice[B]: the next request of each vehicle that is parked at the yard, or -1.drive[B, 5]: the chunk of each vehicle that drives. The checker and the shield ofenv.Envapply (env.Env.take).
At each decision the environment gets the window of the route of each row from lanes.window. A vehicle that waits for a zone sees the end of its route before the zone. The vehicles at the yard and at a spot are off the lanes.
With more than one vehicle in a scene and the fast paths on (paths=fast.choose()), the physics kernel runs one physics step for each launch. The environment writes the peers between the launches. With the kernel of agent rows (fast.choose(agents=True)), one launch does the physics of the decision. The step of the environment has no host sync.
Each state machine of the environments has named states, one transition function and its state in one place:
| State Machine | States | Transition Function | State |
|---|---|---|---|
| Round of a vehicle | parked, loading, out, waiting, serving, leaving, back, failed | env_rounds.round_step |
round [B] |
| Life of a request | hidden, open, taken, service, served | env_rounds.request_step |
req_state [E, Q] |
| Place of a vehicle (rounds) | off the lanes, on the lanes | env_rounds.place_step |
present [B] |
| Episode of a scene (rounds) | running, ended | env_rounds.episode_step |
done [E] |
| Zone of the meeting rule | free, wait, hold | meeting.zone_step |
zone [B, Z] |
| Deadlock detector | clear, cycle, deadlock | agents.deadlock_step |
dl_state [B] |
| Back-off of the reference drive | drive, back | baselines/drive.backoff_step |
ReferenceDrive.bo |
| Turn of the wheels at rest before a plan from rest | follow, turn | env.turn_step (the physics kernel does the same) |
pturn [B] |
Pose hold of the drive env (pose model dr) |
drive, paused | env_drive.pose_hold_step |
paused [B] |
| Call of a skill | idle, running, success, failure, ask | skills/env.call_step |
call [B] |
| Episode of a scene (skills) | running, ended | skills/env.scene_step |
done [E] |
The machines of items.py, loads.py and harvester.py are in their own tables (Items, Slots and Resources. The
skill pages). The door of the shed and its worker are two machines (door_step, worker_step). The flag pending
of the shed (a bale was stored after the last check) is an input of the worker that only the worker's transition
clears.
These are not state machines. Each is a timer, a count or a measured value:
| Value | Where | What It Is |
|---|---|---|
outage, stale, badscan |
env_drive.py |
Timers: the decisions left of a pose outage, a stale pose and a bad scan. _faults draws the start and the length. Each decision counts down. The pose hold reads outage. |
out_age, pause_t, good_t, pauses |
env_drive.py |
Timers and a count of the pose hold: the outage's age, the time paused, the time paused with a good pose, the episode's pauses. |
| The episode end of the drive env | env_drive.DriveEnv.step |
An event, not a state: a row that ends (success, contact, corridor, time, a hard fail of the judge, the end of the pose hold) starts a new scene in the same step. With agent rows, finished [B] is the state of an agent (driving, finished) and agents.episode_end is its transition function. |
present of the skill env |
skills/env.py |
The live agents. It does not change. (In the rounds env present is a state machine since 18 Nov 2026: the place of a vehicle, env_rounds.place_step. See the table above.) |
present of the observation |
env.Env._observe |
A measured value: a thing nearer than 60 m. It is not kept. |
rerouted, launched |
env.py, env_drive.py |
Flags that are set one time in an episode (a reroute, a fast thing at its start time) and stay. |
The fields of an actor: seen_s, waited_s, going |
world.step, the physics kernel's _things (the same rules) |
seen_s is a timer: -1 until the actor notices the controlled vehicle, then the time since. The actor reacts when it is at least delay_s. waited_s is a timer: the time that a person stood for the controlled vehicle, or that a vehicle stood with that body in its way (the squeeze). going is a flag that is set one time and stays: the person waited longer than patience_s and walks on. The halt of a person and the brake of a vehicle are conditions of each step, not states. |
wait_t |
env_drive.DriveEnv.step |
A timer of the stall cut of training: the time of the last wait in the episode. A key of the state since 18 Nov 2026: a reset sets it to 0 and a snapshot keeps it. Before, it was the attribute _wait_t of the env, and no reset cleared it: the cut of a row depended on its earlier episodes. |
_phys_seed, _sv, _pose_src |
fast.advance_fused, env_drive.py |
A counter of the seed of the kernel's noise. The version of the state and the source of the pose in it (true, believed, stale) for the caches of visibility.py: the key of a cache entry. Each change of the state increments _sv (the physics, the tracks, a reset, env_drive.restore). |
The caches of visibility.py hold no address. The line of sight, the scan and the discs of rule C are made one time for each state version and pose source. Before 18 Nov 2026 the key also held the data_ptr of the pose and of the things. A new tensor at the address of a freed one gave a false hit. A copy at another address gave a false miss: a new scan, with new draws of its noise.
Thus a result changed with the layout of the GPU's memory. One more tensor of 16 KB before the run changed 826 of 976 episodes of the farm (911 against 918 successes). With the key of now, a tensor of 16 KB or 4 MB before the run gives the same 976 episodes, bit for bit (917 successes). The scans are fewer: the evaluation of the farm takes 89 s, not 163 s (oats5). Tests/Fast/test_layout.py (test_memory_layout, test_scan_cache_key) holds this.
from acres_batch import env_rounds, fast, scenarios_rounds
from acres_batch.baselines import drive, vrptw
scenes = scenarios_rounds.build("test", 2, 64) # 64 scenes of the real farm, 2 vehicles each
env = env_rounds.RoundsEnv(scenes, paths=fast.choose())
high, low = vrptw.VRPTW(env), drive.ReferenceDrive()
info = env.step(high(env), low(env))
logs = env.episode_log() # for verify_rounds.grade
Run the tests:
python -m pytest Tests/Fast/test_vehicle_kinds.py Tests/Fast/test_check_kinds.py -q -s -m "unit or integration"
python -m pytest Tests/Fast/test_rounds.py -q # unit tests
python -m pytest Tests/Fast/test_rounds.py -q -m integration # the checks on scenes of the real farm (GPU)
Items, Slots and Resources#
The module Fast/acres_batch/items.py keeps the items, the slots and the resources of the procedure tier (work package WP8 of the benchmark design). The items are the round bales of task P1. All tables have fixed sizes and masks. The functions work on all scenes at one time and do not cause a host sync.
| Part | Shape | Content |
|---|---|---|
Items |
[E, 128] |
The pose, the box, the mass, the state, the holder agent and the slot of each item. The rain on it and the moisture of its hay. |
Slots |
[E, 64] |
The pose and the level of each place of a stack, the two slots that must be full first, the state and the item. |
Resources |
[E, 32] |
Gates, doors, docks and single-track segments: the kind, the region, the holder. The claim of each row is [B, 32]. |
Shed |
[E] |
The door of the shed and the worker at the shed. |
Baler |
[E] |
The round baler of the scene: the state and the hay in the chamber. |
Windrow |
[E, 4096] |
Segments of 1 m of the windrow: the position, the hay mass, the field and the state. |
Each part is a state machine with named states and one transition function:
| State Machine | States | Transition Function |
|---|---|---|
| Item | absent, field, carried, stored | item_step |
| Slot | none, free, full | slot_step |
| Claim of a row on a resource | free, wait, hold | meeting.claim_step |
| Door of the shed | closed, opening, open, closing | door_step |
| Worker at the shed | post, walk_in, check, walk_out | worker_step |
| Round baler | filling, full, wrapping | baler_step |
| Windrow segment | none, laid, taken, lost | windrow_step |
Bale. A round bale is a cylinder 1.2 m long and 1.2 m across, with a mass of 450 kg. These are the values of the game. The yaw of an item is the direction of its axis.
Take and place an item. Call these functions:
- At a decision,
engage: a loader row takes the item that it names. The load point of the spear must be within 0.5 m of the centre of the item. The heading must be within 15° of the axis of the item. The speed must be less than 0.5 m/s. - At each physics step,
carry: the carried item stays on the spear of its holder. - At a decision,
release: the row puts its item into the slot that it names, or on the ground (slot -1). The item must be within 0.3 m and 10° of the pose of the slot.
engage and release give a code for each row (ENGAGE_CODES, RELEASE_CODES). For example, the code rule tells that the stack rule refused the slot. Two rows that name one item or one slot at the same time: the lower agent gets it.
Stack rule. A slot is valid when it is free and each slot that it needs is full. stack_slots makes a stack of 4 x 8 places on 2 levels. In this stack, a slot above needs the slot below it. A slot on the floor needs the top slot of the place behind it. Thus the loader fills the stack from the back to the front and from the bottom to the top.
The stack rule does not tell whether the body of the vehicle can get to a slot. The contact test and the checker tell that.
Resources. A row claims a resource with resource_step. The claim is the reservation of meeting.py, the same reservation that the delivery rounds use for their single-track zones. One row at a time holds a gate, a door or a dock. Rows of one direction share a segment. A row that is in the region of a gate, a door or a dock and does not hold it is an intrusion.
Shed. shed_step moves the door and the worker:
- The door opens for a row that waits for it or holds it. It closes when no row wants it and its leaf is clear.
- The worker works the door from the post beside the door.
- After a row stores a bale and no row holds the door, the worker walks to the stack and checks it.
- While the worker is away from the post, the door does not move and no new row gets it.
Bale formation. pickup takes the windrow segments under the pickup of the baler into the chamber. When the chamber holds the mass of a bale, the pickup takes no more hay. The baler must stop. It wraps the bale for 20 s, and then form ejects the bale at the chute. The axis of the bale is across the travel of the baler.
run_over marks the windrow segments under a wheel as lost.
What the rows see. A LiDAR scan and a contact test of 128 items for each row cost too much. cull gives each row the 16 items nearest to its body at each decision. item_things makes things of these items, and refresh writes their poses at each physics step. shed_things makes things of the door leaf (while the door is not open) and of the worker. Put these things after the peer slots of the row (cat_things).
A carried bale.
- The payload:
payloadgives the mass of the carried item forvehicle.stepand the physics kernel. - The contact: at each decision,
bodygives the boxes of the body of each row. These are the boxes of the vehicle frame and the box of the carried bale.contacttests them against the things at each physics step. On a GPU,kernels/items.pydoes the test in one launch. - The checker: the box of the front loader in the body of the checker holds a bale on the spear. Thus the bale does not change the body of the checker.
Against the items, use the body of the vehicle box and the carried bale only (body(..., frame=False)). The fork touches a bale when it takes it.
from acres_batch import agents, items
lay = agents.layout(E, A, "cuda")
it, sl, rs, sh, bl, wr = items.make(E, A, "cuda")
pose, level, need = items.stack_slots(30.0, 0.0, 0.0) # a stack of 4 x 8 places on 2 levels
for e in range(E):
items.put_slots(sl, e, pose, level, need)
code = items.engage(it, lay, veh, kind, want, target, t) # at a decision
code = items.release(it, sl, lay, veh, want, slot, t, sh)
idx = items.cull(it, sl, lay, veh, kind, exclude=target)
things = items.cat_things(things, items.item_things(it, lay, idx), items.shed_things(rs, sh, lay))
body = items.body(it, lay, kind)
items.carry(it, lay, veh) # at each physics step
items.refresh(things, it, lay, idx, T) # T: the first item slot of the things
hit = items.contact(things, veh, body)
Run the tests and the checks:
python -m pytest Tests/Fast/test_items.py -q -m "unit or integration"
python Fast/Tools/items_check.py --json Results/Fast/items.json
The results are in Results/Fast/items.json. The values of the round baler (the wrap time, the chute), of the door and of the worker are assumed. They are not measured. The lift of the loader is not modelled. The level of a slot is a rule, not a height. No environment uses the items yet (work packages WP9 and WP10).
Skills#
The package Fast/acres_batch/skills/ runs the skills of the procedure tier (work package WP9 of the benchmark design). The page Skills: Framework and Contract gives the interface and the order of the calls.
| Module | Content |
|---|---|
skill.py |
The definition and the reference of a skill, the command of a decision and its streams |
env.py |
SkillEnv: the scenes of the banks, the call of each row as a state machine, the checker with the body of each row |
library.py |
The reference skills as one controller |
bank.py |
The format of a scene, the splits, the identity of a scene for the event log |
macro.py, verify.py |
The interface of a procedure, and the verifier of level L1 |
drive.py, dock.py, wait.py |
The skills K1, K10 and K13 |
SkillEnv uses the parameter table of the kinds (vehicle.kinds()) and the body of each row in the checker. It also uses the payload, the trailer, the items and the resources of items.py. The step of the environment has no host sync.
from acres_batch import fast, skills
from acres_batch.skills import bank, library, macro
from acres_batch.skills.env import SkillEnv
env = SkillEnv(bank.build("dock", "test", 64), skills.SKILLS, paths=fast.choose())
lib, caller = library.Library(env.skills), macro.FirstCall()
env.step(macro.decision(env, caller, lib)) # one decision
Limits#
- The vehicle model is kinematic with fitted loops. It is not the dynamics model of the game or of ACRES Core.
- The parameters of the Maxxum and the sizes of its implements are estimates. They are not measured.
- The LiDAR scan uses the body of the Polaris for all kinds. The peer slots use it in the drive and delivery-rounds environments only. With
Env.bodies="polaris"(the old default) the contact test and the shield of the physics use it too. - The scenes are procedural. Most of them do not come from the ACRE map.