Procedure Layer#
This page gives the layer that each procedure task of the benchmark uses: P1 hay, P2 harvest, P3 spraying (sections 6.3 to 6.5 of Farm Benchmark Suite: Design, work package WP10). A task gives its scenes, its task graph and some hooks. The layer gives the rest: the chain of skill calls in one episode and the state machines of the procedure. It also gives the metrics of section 6.4, the verifier, the event log, the abstract mode and the runner.
| Part | File |
|---|---|
| The graph, the state machines, the full mode, the abstract mode, the list scheduler | Fast/acres_batch/env_procedure.py |
| The verifier | Fast/acres_batch/verify_procedure.py |
| The tasks by name | Fast/acres_batch/procedure_tasks.py |
| The proof task (section 5) | Fast/acres_batch/scenarios_refill.py |
| The runner: episodes, event log, re-simulation, checks, abstract mode, speed | Benchmark/acres_bench/procedure.py |
| The tests | Tests/Fast/test_procedure.py |
Each number on this page comes from a file in Results/Benchmarks/ that the table or the text names.
Status (12 Nov 2026): the task P3 is built on the layer (P3).
1. A Chain of Skills in One Episode#
The skill environment (SkillEnv, Skills: Framework and Contract) already runs a new call on a row when the call of the row has ended. The full mode of the layer, ProcedureEnv, is a SkillEnv with these changes. SkillEnv and the skill banks do not change. The L1 checks of the skills give the results of before.
- A call starts only through a node of the task graph (section 2). A call of the command without a node starts nothing.
- When the skill of a new call has the argument
route, the row goes on that route first (at its arc 0), before the start condition of the skill. Thus the start condition reads the new route. A chain must thus have each route start where the call before it ends. A skill with the argumentstart_m(K5) starts at that arc when the call puts the row on a new route. An example is a coverage that goes on after a refill. - The environment and the reference library run the start conditions, the monitors, the effects and the references of the skills of the scenes' graphs only (
SkillEnv.used). The skill banks keep all skills. - With a field and loads, the sprayer's tank of
work.pyis the row's store ofloads.py(1 kg for each litre: an assumed value). A refill (K12) fills the tank. - A scene ends at the end of its procedure (section 3), not when the calls end (
ends_with_callsis false). - The scene has the keys of the graph (section 2) and
t_lb, the lower bound of the makespan.
A scene of several places is a scene of the skill banks with several routes (at most 16, lanes.N_ROUTES) and several static things (at most 4). It has resources (at most 32, items.R_MAX), stores (at most 4, loads.S_LD), one shed and one field window of 256 m (work.py). bank.approach makes the route of a K10 dock to a pose. The proof task uses it, and the K10 bank now uses it too (the same scenes, bit for bit).
2. The Task Graph as Data#
A task makes its graph with env_procedure.graph(nodes, n_max, events). Each node is an env_procedure.Node:
| Field | Scene key | Meaning |
|---|---|---|
skill, args |
pg_skill [N], pg_args [N, 4, 8] |
The skill call: the skill's name and its arguments by name. The arguments can be different for each vehicle. |
agent, kind, implement |
pg_agent, pg_kind, pg_impl [N] |
The vehicle, the vehicle kind and the implement that can run the node (-1: any) |
pred |
pg_pred [N, 4] |
The nodes that must be done before the node starts (precedence) |
resource |
pg_res [N] |
A resource of the procedure (0 to 7) that the node holds while it runs. One vehicle at a time holds a resource. |
retry, alt |
pg_retry, pg_alt [N] |
The branches of a call that fails: the number of retries, then the alternative node, then stop_and_ask |
release_s |
pg_release [N] |
The time at which the node becomes known. Infinity: a branch or the task's hook events releases it (for example a bale that the baler drops). |
work |
pg_work [N] |
The weight of the node in the default work share \(W\) |
The events of a scene are pg_events [8, 4]: the time, the kind, the target and the value. The kind breakdown stops vehicle target for value seconds (infinity: to the end). Its running call ends with the reason breakdown. Its node becomes ready again, and the retry count does not change.
The solver of level L2 gives one node for each free vehicle at each decision (-1: none). It can also give its own arguments of the call (the parameters of the calls are the solver's part at L2, section 6.5 of the design). The layer starts the node when these conditions are true:
- the node is ready,
- the vehicle is free and can run the node (agent, kind, implement),
- no other vehicle holds the resource of the node.
When two vehicles of a scene want one node or one resource, the lower agent gets it. A vehicle that wants a node whose resource another vehicle holds waits: this is its blocked time.
3. The State Machines#
Each state machine has named states, one transition function and its state in one place (env.state).
Node (NODE_STATES, node_step, state["nstate"] [E, N], not state["node"], the state of the gearbox "vehicle").
| From | Event or Condition | To |
|---|---|---|
| hidden | its release (time, branch, task event) | blocked |
| blocked | each predecessor is done | ready |
| blocked | a predecessor is asked or cancelled | cancelled |
| ready | the solver dispatches it | running |
| running | the call succeeds | done |
| running | the call fails, a retry is left | ready |
| running | the call fails, no retry, an alternative | replaced (the alternative is released) |
| running | the call fails and nothing is left, or the skill asks | asked |
| running | the vehicle breaks down | ready |
A replaced node counts as done when its alternative is done.
The guards of the precedence (the two rows from blocked) apply once in each decision, at its end (the transitions of _end). A cancellation thus moves one node down a chain in each decision. The dispatch applies no guards. The call of a decision runs twice in an episode (EP.decision, then the step) and once in a re-simulation. Thus guards there made the episode and its re-simulation differ (P2, 12 Nov 2026).
Vehicle (VEHICLE_STATES, vehicle_step, state["vstate"] [B]): free, busy (a node runs), down (a breakdown, to its repair), asked (it stands to the end).
Procedure (END_CAUSES, procedure_step, state["done"] and state["p_cause"] [E]): running, then ended by one of these causes:
safety: a contact, or the corridor left.deadlock: a cycle of waits that holds 120 s.complete: no node is blocked, ready or running, no node waits for a release time, and the task's hookopenis false.time: the time limit of the scene.
Event (EVENT_STATES, event_step, state["ev_state"] [E, 8]): pending, fired.
4. Metrics, Verifier and Log#
The environment computes the metrics of section 6.4 on the device (metrics()). The verifier (verify_procedure.grade) computes them again from the log alone: the final summary and the events. The checks compare the two.
| Symbol | How the Layer Gets It |
|---|---|
| \(W\) | The task's hook work (default: the work weights of the done nodes over those of the nodes that are no alternative) |
| \(T_{ms}\) | The end of the last done node with a work weight, when \(W\) reaches the task's w_ok. Else the end of the episode. |
| \(T_{LB}\) | The scene's t_lb (the task's relaxation) |
| \(F\) | The fuel of the ground surrogate (ground.py) for the Polaris, on the gravel of the lanes, while the vehicle moves. The Maxxum has no fuel model: \(F\) is none. |
| \(I_a\), \(\iota\) | Slower than 0.1 m/s, while the procedure runs, without a running call of transfer or change_implement |
| \(I^{blk}_a\) | Idle, and the resource that the vehicle wants is held by another vehicle, or the vehicle waits for a resource of the scene (a claim in the state wait) |
| \(D\) | The detector of P4 (agents.detect) and its count, now shared (agents.count_step): a cycle of waits that holds 30 s counts, 120 s fails |
| \(R_{safe}\) | Contacts and corridor exits of all vehicles |
| \(Q\) | \(W\,T_{LB} / \max(T_{ms}, T_{LB})\), 0 with a safety event or a deadlock failure |
The verifier. The final summary has a record of the last call of each node. The record has the call state, reason, monitors and arguments, and the contact, corridor, distance and idle time.
The verifier grades each record with the grade of its skill. Thus a node counts as done only when the definition of its skill passes. A solver's own skill at L3 that reports a false success does not count. Then the verifier checks these rules:
- A node starts after each of its predecessors is done.
- One vehicle at a time holds a resource, and a vehicle runs one node at a time.
- The nodes with a
doneevent are the done nodes, at the times of their ends.
The task's hook grade gives the task's \(W\) and its own conditions. Then the verifier computes \(T_{ms}\), \(Q\) and the success: \(W \ge\) w_ok, no safety event, no deadlock failure, no rule broken, and the task's conditions.
The log. The streams are those of the skills (skill.STREAMS) and node (int16, the solver's node choice). The events are those of the skills and these new kinds: dispatch, done, branch, ask (value: the node) and breakdown (Event Log and Verifier). python -m acres_bench.verify LOG.json runs a log again and grades it.
5. The Proof Task: Refill at a Nurse Tank#
The task refill (scenarios_refill.py) is the smallest procedure that uses each part of the layer. One or two sprayers (the Maxxum with the folded sprayer, a tank of 800 kg) refill at one nurse tank. Each vehicle has two nodes: K10 dock beside the tank, then K12 transfer from the tank until its tank is full. The transfer holds the tank's pump (resource 0), so the second vehicle waits for the first. The routes and the tank are those of the K10 and K12 banks at a nurse tank.
\(W\) is the share of the vehicles whose tank is full. The success needs \(W = 1\).
The checks of section 9.3 of the design ran on the test banks of 64 scenes each (procedure_refill_validity_a1.json, procedure_refill_validity_a2.json). They ran again on 13 Nov 2026 on the final tree of stage 1, commit dfd3194, on an L40S shared with other work. They used the exact scene clock and the fitted Maxxum.
They used the owner's settings of 11 Nov 2026 (procedure.VEHICLE): the follower, the gearbox and the bodies of the vehicle's software. These settings also have the step without a host sync and the kernel of agent rows. Each log names them in its options. The reference is the list scheduler greedy over the reference skills (level L2). The verifier grades its own run of each log.
| Vehicles | Solver | Passes | \(Q\) | \(T_{ms}\) (mean) | \(T_{LB}\) (mean) | \(\iota\) | Blocked (mean, s) | Logs that repeat | Verifier = env |
|---|---|---|---|---|---|---|---|---|---|
| 1 | do-nothing | 0 of 64 (end: time) | 0 | 390.9 s | 139.2 s | 1.00 | 0 | 64 of 64 | 64 of 64 |
| 1 | reference | 64 of 64 (Wilson 95 %: 0.94 to 1.0) | 0.873 | 158.8 s | 139.2 s | 0.011 | 0 | 64 of 64 | 64 of 64 |
| 2 | do-nothing | 0 of 64 (end: time) | 0 | 617.7 s | 265.2 s | 1.00 | 0 | 64 of 64 | 64 of 64 |
| 2 | reference | 64 of 64 (Wilson 95 %: 0.94 to 1.0) | 0.916 | 288.7 s | 265.2 s | 0.441 | 122.4 | 64 of 64 | 64 of 64 |
With the defaults of 11 Nov 2026 (batch.md, Defaults of the Settings) the reference completes 64 of 64 with 1 vehicle and 64 of 64 with 2. The do-nothing controller completes 0, and every log repeats (Results/Benchmarks/defaults_switch/after/refill_a1.json, refill_a2.json). With the old defaults on the same tree 64 and 64.
"Verifier = env" counts the scenes in which the verifier's \(W\) and \(T_{ms}\) from the log are those that the environment computed on the device. With two vehicles, one vehicle waits for the pump in each scene (the blocked time). No scene had a safety event or a deadlock. The fuel is none: the Maxxum has no fuel model. The idle share of the do-nothing solver is 1.0000.
With the gearbox "vehicle", the layer first kept the states of the nodes in state["node"], the key of the gearbox's node, and every dock missed. The key is now state["nstate"].
The tests (test_procedure.py) run the same checks on 4 scenes with the kernel of agent rows and sync-free on. They also test a breakdown in the full mode, and a decision with no host sync (torch.cuda.set_sync_debug_mode("error")).
6. The Abstract Mode#
AbstractEnv runs the same graph and state machines with no vehicle that moves. A dispatched call draws its outcome (success, failure, ask) and its duration from the L1 statistics of its skill (macro.l1_stats of the skill's check file). The duration is the inverse of the piecewise linear distribution through the quantiles 0.1 to 0.9. The slopes of the outer quantiles extend it to 0 and 1. Time jumps from event to event: the end of a call, a release, a breakdown, a repair. The task's l1_where names the scenes of each skill's bank (for refill: the K10 scenes at a nurse tank, the K12 scenes of the family refill).
The test of WP10 (procedure_refill_abstract.json, this run used the defaults of the simulator on the final tree of stage 1, 13 Nov 2026, commit dfd3194). It compares the makespan of the abstract mode with the full mode on the same 1,000 scenes of the test split. The comparison is for each count of vehicles, by the two-sample Kolmogorov-Smirnov test. Two sources of the statistics:
l1: the L1 check files of the skills (the design's source): 24 scenes of K10 at a nurse tank, 17 scenes of K12 of the familyrefill.chain: the calls of the full mode on 1,000 scenes of the train split (procedure.chain_stats): the skills as the chain calls them.
| Vehicles | Statistics | Success, full / abstract | \(T_{ms}\) mean, full / abstract | Difference | KS statistic | KS p | p > 0.01 |
|---|---|---|---|---|---|---|---|
| 1 | l1 |
1.000 / 0.956 | 158.7 s / 130.9 s | -27.9 s | 0.409 | 3e-75 | no |
| 1 | chain |
1.000 / 1.000 | 158.7 s / 155.4 s | -3.3 s | 0.063 | 0.038 | yes |
| 2 | l1 |
1.000 / 0.918 | 285.8 s / 228.6 s | -57.3 s | 0.376 | 3e-63 | no |
| 2 | chain |
1.000 / 1.000 | 285.8 s / 283.3 s | -2.5 s | 0.130 | 8.8e-8 | no |
The L1 statistics do not give the makespan of the chain. The K12 bank has tanks that become empty, part amounts and rows that start in position. Its transfers are shorter (median 96 s) than a refill to full in the chain (median 120 s). The K10 bank has one time-out in 24 scenes, the chain none. With the statistics of the chain, the difference is 3 s.
With two vehicles the test still fails. The abstract mode draws each call apart, but in a scene of the full mode the two refills share the pump's rate. A task that trains in the abstract mode must thus calibrate it on the chain and report the difference.
7. Speed#
The speed of section 7.5 of the design with the procedure state on (procedure_refill_speed.json, python -m acres_bench.procedure speed refill --E 2048 --agents 2). The setting has 2,048 scenes of 2 vehicles (the train bank of refill, 64 scenes repeated). It has the fast paths with the kernel of agent rows and sync-free (the defaults). It has 200 decisions after 20 of warm-up, and a synchronised timer for each part. Commit dfd3194, 13 Nov 2026, an NVIDIA L40S that ran nothing else, PyTorch 2.11, Triton 3.6.
| Part of a Decision | ms |
|---|---|
The solver (greedy), dispatch and call (the layer) |
2.9 |
The reference skills (Library, with the 18 candidates of the reference drive) |
23.9 |
ProcedureEnv.step with one chunk for each row (the checker, the physics, the items and loads, the layer's end of a decision) |
23.8 |
| Case of 7.5 | Measured | Target |
|---|---|---|
| One candidate for each agent: the layer and the step | 153,200 agent-decisions/s | 50,000 |
| A search planner: the layer, the reference skills and the step | 81,000 agent-decisions/s | 5,000 |
| The abstract mode, 16,384 and 65,536 scenes of 2 vehicles | 2.25 and 8.99 million skill events/s | 1,000,000 |
The files of before were of a shared GPU: procedure_speed.json (11 Nov, commit b6a7e7d, about 90 % in use by others) gave 77,000 and 38,000, and the file of 12 Nov (four other runs at about 99 % use) 21,500 and 9,000. Results/Fast/speed_defaults.json has the same task with the defaults of before and of now: 154,300 and 156,100. The settings of the vehicle's software (the follower and the gearbox "vehicle") do not cost speed here. The layer has no host sync in a decision (0 under torch.cuda.set_sync_debug_mode("warn")), and it is 11 % of the decision of one candidate. The peak memory is 1.9 GB.
The case of one candidate has no observation and no policy: the procedures have no observation of a learner yet. In the drive env the observation is 37 % of such a decision (benchmarks.md, WP11). Thus a learner on a procedure will be slower than this number.
8. A Task on the Layer#
A task is a subclass of env_procedure.Task in Fast/acres_batch/scenarios_<task>.py:
| Part | Content |
|---|---|
name |
The task of the event log (refill, p1) |
scene(rng, split, index, agents) |
One scene: the keys of bank.scene (the routes, the things, the resources, the stores, the field), route0 and arc0 of each vehicle, the graph keys of env_procedure.graph, t_lb, and meta. The meta must have the keys that the grade of each skill of the graph reads (K12: cap_kg). Draw each value from rng. |
work(env) |
\(W\) [E] on the device (default: the node weights) |
grade(final, base) |
\(W\) and the task's metrics from the final summary, on the host. Set task_ok False when a condition of the task fails. It must give the \(W\) of work on the same episode. |
summary(env) |
The task's part of the final summary of each scene (default: none) |
events(env) |
The nodes that the scene's state releases now, and their new arguments (default: none) |
open(env) |
[E]: more nodes can still come (default: false) |
scene_step(env) |
The task's own transitions of its scenes in a decision, first in the end of the decision (after the physics, the effects and the monitors). P1: the rain on the bales and the moisture of the windrows. Default: none. |
COUNTERS, counters(env, c) |
The task's counters and their increments [E, C] in a decision. The layer adds them while the procedure runs. The final summary has them (P3: the product sprayed above the wind limit). |
SOLVERS, solver(name, env), METRICS |
The task's other solvers. The fields of its grade that a check keeps for each scene |
reference(env) |
The classical solver (default: greedy, the list scheduler) |
l1_where, w_ok |
The scenes of the L1 banks for the abstract mode. The \(W\) of a success |
complete(env) |
[E]: the task's own end of the procedure in the full mode (cause complete), in the place of the layer's (default: none, the layer's). P2: the target is harvested. |
keep_arc |
True: a call that puts a row on a new route keeps the row's arc. The condition is that the new route has the row's point at that arc (within 0.01 m). This is for routes with a shared start (P2). Default false: arc 0, as before. |
makespan |
"nodes" (default): \(T_{ms}\) is the end of the last done work node. "end": the end of the episode (the task's complete ends it at its last work event: P2). The verifier uses the same rule. |
SETTINGS |
The task's values of ProcedureEnv.SETTINGS (default: none). A run's own settings win. Each log names the values in its options (P3: spray_wind "now") |
Then add the task to procedure_tasks.TASKS and to TASKS of Benchmark/acres_bench/verify.py. The checks (procedure.check) are check_solver for each solver and combine. A task's runner can make the part of each solver in a process of its own and join them (P1: P1, section 10). A short example (the graph of one vehicle of the proof task):
from acres_batch import env_procedure as EP
nodes = [EP.Node("dock", {0: dock_args}, agent=0),
EP.Node("transfer", {0: fill_args}, agent=0, pred=(0,), resource=0, work=1.0)]
scene.update(EP.graph(nodes, 4))
scene["t_lb"] = np.float32(drive_s + flow_s)
python -m acres_bench.procedure validity refill --agents 1 --n 64 # Results/Benchmarks/procedure_refill_validity_a1.json
python -m acres_bench.procedure validity refill --agents 2 --n 64 # ..._a2.json
python -m acres_bench.procedure abstract refill --n 1000 # procedure_refill_abstract.json
python -m acres_bench.procedure speed refill --E 2048 --agents 2 # procedure_refill_speed.json
python -m pytest Tests/Fast/test_procedure.py -q -m "unit or integration"
9. Limits#
- One field window of 256 m for each scene (
work.py): the fields of a scene must lie in it, orwork.pyneeds more windows. - At most 16 routes, 4 static things, 4 stores for each scene. The route of a new call starts at its arc 0, or at
start_m(K5, and K8 since P1). Withkeep_arc(11 Nov 2026) it starts at the row's arc where the two routes share their points. - Several routes on one way (a gate, a door) need the corridor of each route to be its own chain (
lanes.packandbank.scenewithown_chain, P1). Else two chains on one way crowd the checker's nearest capsules and it refuses each forward chunk (k9.md, section 7). - The fuel has a model for the Polaris only, on the gravel of the lanes. The fuel while the vehicle stands is not counted.
- The abstract mode has no physical state: the task's hook
events(for example a bale that the baler drops) does not run in it. - The engage of K7 and the release of K9 are not counted as work in the idle time (one decision each).
- The scenes of the proof task are procedural, split by the seed, not on the farm map.
- The time of a scene is its count of physics steps times the step of 0.05 s (
env.clock, the physics kernel has the same). The code reads the count back from the time, which is exact under 4 million steps (58 h of scene time). Before 12 Nov 2026 the time was a float32 sum of the steps. It was 1.75 s ahead at 3,000 s and 28 s behind at 12,000 s.