01Five keys, compared lexicographically#
Units left over, containers opened, container cost, unused volume and stack height, compared ascending, so lower is better. The reference table below pairs each one with the key it arrives under. Ratios are carried as parts per million so the whole vector stays integral.
02What was left over comes first#
No objective may hide an incomplete answer. Six of the seven rank the units left over first, so an arrangement that leaves an item behind ranks worse than one that does not. maximum_volume, added in 1.6.0, ranks the volume left over first, in parts per million of the volume requested, and the units second: it will leave three small items out to pack one large one.
03A lower bound, and the gap to it#
Under default and lowest_cost from 1.8.0, maximum_value, open_dimension_height and maximum_volume from 1.10.0, and shipping_cost and lowest_landed_cost from 1.11.0, a result carries optimality.lower_bound: a vector no arrangement can score below, computed from the request alone. Where the answer is above it, gap_key names the first key that differs, absolute_gap says by how much and relative_gap gives that as a fraction of the bound. A result is optimal only when it reaches the bound - which proves no better arrangement exists - and validate checks both the bound and the gap. The Playground prints them under every run.
04The formula is universal, the value is not#
Every engine computes the vector the same way and none may misreport the score of the packing it returned. Engines that return different but equally valid arrangements score differently, which is a stated non-guarantee rather than a defect.
Reference tables
Read from the same constants the engine, the playground and the validator use, so this page cannot drift from the code.
Score vector by objective
| Objective | Keys in ranking order |
|---|---|
defaultFewest containers |
|
lowest_costLowest container cost |
|
shipping_costLowest billable weight |
|
lowest_landed_costLowest carrier charge |
|
open_dimension_heightLowest stack height |
|
maximum_valueMost value packed |
|
maximum_volumeMost volume packed |
|
unpacked_countUnits left overcontainer_countContainers openedtotal_cost_minorContainer costin minor currency unitsunused_volume_ppmUnused volumeparts per million, added up over the containersstack_height_ppmStack heightparts per million of container height, added upbillable weightBillable weightin weight ticks of 1/8 µg, the larger of gross and dimensional weightcarrier chargeCarrier chargein minor currency units, from each container's rate tableachieved height in ticksHeight achievedin ticks of 1/16000 mmvalue forgoneValue forgonein the caller's own scale, summed over the items left overvolume left overVolume left overparts per million of the total volume of the items requested