DOCUMENTATION / START → DO → UNDERSTAND → LOOK UP

Documentation, organised by the question you arrived with.

Start, common tasks, understand and reference stay separate, so the contract can be looked up without reading an argument about architecture first.

Docs for Packvium 1.12.x · contract stable since 1.0

START FROM THE TASK

I need to…

The reference below is organised by what the engine is. These are organised by what you came to do: each one is a recipe with the smallest snippet that does it, the rule it relies on, and a complete request to run.

01

START

Get one real answer out of it

First packed container

Install one package, send one request on stdin and read the answer in order: the status, the containers, what was left behind and the score.

  • Install the engine for your runtime
  • Send the smallest useful request
  • Read the answer in order
Open

Getting started in Python

Install packvium, build items and containers as Python objects, run Packer.pack(), and read why an item was left out rather than guessing.

  • Install
  • Build items and containers
  • Run pack() and read the result
  • Handle items the engine could not place
  • What is already checked before you see it
  • Check a result yourself
  • Next steps
Open

Getting started in PHP

Install packvium/packvium, build items and containers as immutable value objects, call Packer::pack(), and read why an item was left out.

  • Install
  • Build items and containers
  • Run pack() and read the result
  • Handle items the engine could not place
  • What is already checked before you see it
  • Check a result yourself
  • Next steps
Open

Getting started in Node

Install @packvium/engine, call pack() with a plain object, and read why an item was left out.

  • Install
  • Call pack() and read the result
  • Handle items the engine could not place
  • What is already checked before you see it
  • Check a result yourself
  • Write a result as JSON
  • Next steps
Open

Getting started in Rust

Add packvium, call pack_json() with the request as a string, and read the result back out of the JSON it returns.

  • Install
  • Call pack_json() and read the result
  • Handle items the engine could not place
  • What is already checked before you see it
  • Check a result yourself
  • Next steps
Open

Getting started in the browser

Install @packvium/browser, await pack() with a plain object, and read why an item was left out.

  • Install
  • Call pack() and read the result
  • Handle items the engine could not place
  • What is already checked before you see it
  • Check a result yourself
  • Write a result as JSON
  • Next steps
Open

Getting started in Go

Add the Go module, build items and containers from validated specs, call Pack(), and read why an item was left out.

  • Install
  • Build items and containers
  • Run Pack() and read the result
  • Handle items the engine could not place
  • The same JSON contract, from the command line
  • Hand the result to a warehouse system
  • Even out the weight across containers
  • Where it differs from the reference engine
  • Next steps
Open

Getting started in Java

Add com.packvium:packvium, build items and containers with builders, call Packer.pack(), and read why an item was left out.

  • Install
  • Build items, run pack() and read the result
  • Handle items the engine could not place
  • Pack a JSON request
  • Hand the result to a warehouse system
  • Even out the weight across containers
  • Where it differs from the reference engine
  • Next steps
Open

Getting started in .NET

Add the Packvium NuGet package, build items and containers, call Packer.Pack(), read why an item was left out, and export a work order.

  • Install
  • Build items, run Pack() and read the result
  • Handle items the engine could not place
  • Pack a JSON request
  • Hand the result to a warehouse system
  • Even out the weight across containers
  • Where it differs from the reference engine
  • Next steps
Open
02

COMMON TASKS

Solve one specific task

Shipping quotes and policy rules

Price a shipment against your own versioned rate card, decide whether it may ship at all, and keep the exact version every decision used.

  • What the commerce layer does
  • Publish your rates as one document
  • Quote a shipment
  • A rejection is an answer, a malformed request is a bug
  • May it ship at all? Policy rules
  • Which master data was used? Catalog versions
  • Next steps
Open

Extending an engine

Five in-process extension points, and the rule that decides when a rule belongs in the request instead of a private application scorer.

  • What you can replace
  • Extensions are not cross-language features
  • When it belongs in the request
Open
03

UNDERSTAND

Understand why it is built this way

Why a library, not a service

The layer boundary that keeps a solver free of networks, clocks and databases, and why packing ships as a library rather than a service.

  • A call in, immutable data out
  • Commerce is a leaf, not a dependency
  • Determinism is a boundary, not a setting
Open

Building a deterministic packing engine, four times

Why this engine is four independent implementations held to one conformance corpus, not one core with four bindings.

  • The problem: a box that fits on paper and not in the truck
  • Why floating point is the wrong arithmetic for this decision
  • Determinism is a boundary, not a setting
  • One request document, four independent implementations
  • A validator that shares no code with the solver
  • How the benchmark numbers are allowed to be published
  • The tradeoffs this makes on purpose
  • What this does not do
Open
04

REFERENCE

Look up the exact contract

Request and result contract

The public fields, what each status means, and the rule a capability must satisfy before it is one: schema, fixture, validator, docs.

  • One schema, four engines
  • What a capability requires
  • Refusals are structured
  • A malformed request is refused by name
Open

The objective vector

How results are ranked, why every key is an exact integer, and what an equal score does not imply: what was left over comes first.

  • Five keys, compared lexicographically
  • What was left over comes first
  • A lower bound, and the gap to it
  • The formula is universal, the value is not
Open

Execution plans

Turn a validated result into a work order an operator can follow, without letting the layer that explains a decision start making one.

  • A view of a result, not a second solver
  • Facts and presentation are kept apart
  • A placement is named by what the contract promises
  • Step order is supplied, never guessed
  • Why an alternative lost
  • Operator locks, in Python
  • Every placement has an id (1.10.0)
Open

Plan revisions and fixed placements

Replan a job already under way: loaded items stay put, and every change is recorded against the plan it changed.

  • Items already loaded stay where they are
  • A fixed item is a real placement
  • A fixed set that cannot hold is refused before any search
  • A revision records what happened on the dock
  • The replan is an ordinary solve
  • An audit that does not stop at the first problem
  • One surface per language
Open

Scenarios and recommendations

Compare a catalog or rule change on recorded orders, replay it on unseen history, and publish it only through approval. Python only.

  • Python only, supported and not frozen
  • A scenario runs against a pin, never against current
  • A comparison is never one number
  • A proposal cannot publish itself
  • Replay on history the proposal did not see
  • What history can and cannot prove
Open
FIRST TIME HERE?

Start with one packed container.

Install one package and pack eight cubes into one carton. Once you have read a real status, a real score and a real refusal, the rest of the contract explains itself.

Open the tutorial