Modules
A faithful Elixir port of BoxPacker (PHP, v4.2.0), a 3D
bin-packing and box-selection engine. Given a set of items and a catalog of candidate boxes, it
chooses which boxes to use and computes how to physically arrange the items inside each one:
orthogonal rotation (:never / :keep_flat / :best_fit), per-box weight limits, weight
redistribution across boxes, stability, and optional placement constraints.
A box/container available for packing. Elixir analog of BoxPacker's Box interface.
Config-driven event publisher for a live packing feed. No callbacks: when
ExBoxPacker.Config.broadcast/0 is set (and absinthe is loaded), each event is
published via Absinthe.Subscription.publish(endpoint, event, [{field, topic}]).
A packing event streamed to subscribers: :started, :box_packed, or :done.
Single-key config reader. All library configuration lives under one key
Optional protocol for items with custom placement rules (e.g. max quantity per box, no
stacking). can_be_packed?/8 is consulted for each candidate placement; return false to
forbid it. Implementing this slows packing. Port of BoxPacker's ConstrainedPlacementItem.
Packs items into a single box. Functional port of BoxPacker's VolumePacker. Tries both
box footprint rotations (unless single-pass or the item set forbids rotation) and each
special first-item orientation, returning the permutation that packs the most (an exact
full pack short-circuits; otherwise highest volume utilisation).
An item to be packed. Elixir analog of BoxPacker's Item interface.
Optional protocol for boxes with a finite supply. A box implementing this is only used up
to quantity_available/1 times. Boxes that do not implement it are treated as unlimited.
Port of BoxPacker's LimitedSupplyBox.
Optional protocol marking items that belong to a named group which must all ship together
in the same box (never split across boxes). Port of BoxPacker's LinkedItem.
Raised (by pack!/3) or returned in {:error, _} (by pack/3) when an item cannot be
packed into any available box. affected_items holds the items that could not be packed.
Port of BoxPacker's NoBoxesAvailableException.
Top-level multi-box packer with catalog box selection. Faithful port of BoxPacker's
Packer::doBasicPacking + getBoxList.
A forward-able Plug that renders a 3D preview of packings captured via
ExBoxPacker.Preview.
Opt-in capture hook for the ExBoxPacker.PackerPreview dev visualiser.
In-memory store of recent packings for the ExBoxPacker.PackerPreview dev tool. Holds a
bounded ring buffer and notifies subscribed Server-Sent-Events connections of new packings.
Add it to your supervision tree (typically dev-only) to enable the preview.
A box together with the items packed into it, plus computed weight, space and
utilisation accessors. Port of BoxPacker's PackedBox.
A collection of ExBoxPacker.Result.PackedBox with aggregate statistics. Port of BoxPacker's
PackedBoxList. Iteration/to_list order is defined by the configured PackedBoxSorter.
An item placed inside a box: back-left-bottom corner at (x, y, z) with the given
post-rotation width/length/depth. volume is precomputed. Port of BoxPacker's PackedItem.
A collection of ExBoxPacker.Result.PackedItem with cached total weight and volume.
Port of BoxPacker's PackedItemList.
Allowed rotation modes for an item, mirroring BoxPacker's Rotation enum.
A ready-made ExBoxPacker.Box implementation for the common case.
A ready-made ExBoxPacker.Item implementation for the common case.
Behaviour for ordering candidate boxes (analog of BoxPacker's BoxSorter).
Default box ordering: inner volume asc, then empty weight asc, then usable capacity asc.
Default item ordering: volume desc, then weight desc, then description asc.
Default packed-box ordering: item count desc, then volume utilisation desc, then used volume desc.
Behaviour for ordering items before packing (analog of BoxPacker's ItemSorter).
Behaviour for choosing the best packed box during selection (analog of BoxPacker's PackedBoxSorter).
Raised when packing exceeds the configured timeout. Port of BoxPacker's TimeoutException.