pylabrobot.lib.liquid_handling.pipette_batch_scheduling#
Plan the fewest X/Y moves that position each channel at its target.
Multi-channel heads share one X carriage, enforce minimum pairwise Y spacing, strictly descending Y by channel index, and per-container geometry (including no-go zones). Given a list of (channel, target container) assignments, this module groups them into batches where each batch is a set of channels whose targets can all be reached in one X/Y move. A Z-axis operation (e.g. LLD probe, aspirate, dispense, …) is then supplied as a callback by the caller.
This is formally a Minimum Exact Cover problem (equivalently, Set Partitioning in OR terminology, or minimum hypergraph coloring in graph theory): pairwise constraints alone reduce to graph coloring; container fit with no-go zones is k-ary, making it hypergraph coloring. Hence the enumerate-then-partition pipeline rather than 2-ary graph coloring. Intended for n <= ~16 channels; planning is O(2^n * n^2) in the worst case, with the branch-and- bound partition solver typically fast on the structured instances this module sees.
Example:
batches = plan_batches(
use_channels=[0, 1, 2, 5, 6, 7],
containers=[w0, w1, w2, w5, w6, w7],
channel_spacings=backend._channels_minimum_y_spacing,
wrt_resource=backend.deck,
x_tolerance=0.1,
)
await backend.execute_batched(func=my_z_callback, batches=batches)
Functions
|
Enumerate every valid batch by backtracking, returning ChannelBatch objects. |
|
Validate a candidate batch against all physical constraints, cheapest first. |
|
Log a tree view of the batch execution plan. |
|
Pick the fewest batches that partition |
|
Container-aware, optimal batch planning (respects no-go zones). |
|
Validate and normalize channel selection. |
Classes
|
A group of channels that can operate simultaneously. |