Mixed palletizing

Build pallets from mixed cargo: send an order's lines, several SKUs together, and get back how many pallets the order needs and where every unit goes on each. It is the request from Anatomy of a job, with one field that declares the problem: problemType.

When to use this

  • You build mixed pallets, for example one store's order of several SKUs, and want to know how many pallets it takes and how to stack each one.
  • You already plan loads with this API and want to know what changes when you build pallets instead.

Walkthrough

The job

Building mixed pallets needs no other schema: the same eight top-level keys as a load plan, with problemType declaring the problem, and the rest of the difference is in what you are asking for rather than in what you send. This is the job the example clients submit:

{
  "units": { "length": "m", "weight": "kg" },
  "problemType": "MixedPalletizing",              // the one field that selects the problem
  "name": "Store 104 mixed pallets",
  "carriers": [
    {
      "externalId": "EUR-PALLET",
      "name": "EUR pallet, 1.8 m build height",
      "category": "pallet",                        // the only value this job accepts; may be omitted
      "geometry": { "type": "box", "dimensionX": 1.2, "dimensionY": 0.8, "dimensionZ": 1.8 },
      "quantity": null,                           // unlimited: the solver decides how many pallets
      "tareWeight": 25
    }
  ],
  "cargo": [
    {
      "externalId": "SKU-4001", "description": "Beverage crate",
      "amount": 24, "weight": 12.5,
      "geometry": { "type": "box", "dimensionX": 0.4, "dimensionY": 0.3, "dimensionZ": 0.25 },
      "constraints": { "allowStackingOnTop": true, "allowedRotations": ["Z"] },
      "groups": ["store-104"]
    },
    {
      "externalId": "SKU-4002", "description": "Cereal case",
      "amount": 18, "weight": 4.0,
      "geometry": { "type": "box", "dimensionX": 0.6, "dimensionY": 0.4, "dimensionZ": 0.3 },
      "constraints": { "allowStackingOnTop": true },
      "groups": ["store-104"]
    },
    {
      "externalId": "SKU-4003", "description": "Egg tray",
      "amount": 6, "weight": 2.2,
      "geometry": { "type": "box", "dimensionX": 0.3, "dimensionY": 0.3, "dimensionZ": 0.15 },
      "constraints": { "allowStackingOnTop": false, "allowedRotations": [] },
      "groups": ["store-104"]
    }
  ],
  "configuration": {
    "objective": "MinimizeCarriers",
    "secondaryObjectives": [ { "type": "CenterLoadMass" } ]
  }
}

Five choices in that body are what make it a palletizing job rather than a load plan:

Choice Why it is there
problemType: "MixedPalletizing" The only field that selects the problem class. Remove it and this exact body is a valid load-planning job, which is also the cheapest way to compare the two: submit it twice, once with the field and once without.
category: "pallet" The only value a MixedPalletizing job accepts on a carrier, inline or referenced; container, truck and trailer are all rejected with 400. Omitting it fills in pallet from problemType and echoes it back, so writing it out documents the intent without changing the outcome. See Building load units.
quantity: null on the pallet Unlimited, so the solver adds pallets until the cargo runs out. That is what turns the answer into how many pallets does this order need. An explicit N answers the narrower question of whether the order fits N pallets, and returns all N instances including any that ended up empty.
Three cargo lines The mix is the point. One line describes a single-SKU pallet, which this same body can express but which is not the problem worth declaring.
Per-line constraints allowStackingOnTop defaults to false, so the two sturdy lines opt in and the trays do not. That, plus allowedRotations: [] on the trays, is what settles the build order. See Constraints.

Reading the result

The example clients print the result as a build sheet instead of a flat list of placements: a block per pallet with the mix it carries, its loaded weight, how high the stack ended up, and its placements ordered bottom to top. Three things in there are worth copying into your own code:

  • The stack height is derived, not returned. No field carries it. A placement's z is its lower corner and sizeZ its rotated height, so the top of the load is the highest z + sizeZ across a pallet's placements.
  • Sort before you print. A carrier's placements come back in no documented order, so do not read the array order as a build order. Sorting by z is what turns the same data into a build sequence.
  • loadedWeight leaves out the pallet itself. It is the summed weight of that carrier's placements; add the tareWeight you submitted for the weight someone has to move. weightUtilization compares it with the pallet's maxWeight, its load capacity, when it has one.

Notes & caveats

  • It has to be on your plan. Nothing in the body shows it: without the feature on your plan, the submit is refused with 403 and code: "mixed_palletizing_not_entitled", before any ceiling is consulted. The way out is a change to the plan, not to the request.
  • It meters its own monthly quota, separate from the load-planning one, as do the three per-job ceilings; one problem type running out says nothing about the other. See Limits & quotas and the code registry.
  • Cargo classes and stacking rules apply here too. A job with problemType MixedPalletizing takes the same classes on its cargo lines and the same constraints.stackingRules as a load planning job, and the rules hold between the boxes on a pallet: with a rule that no cans rest on eggs, no cans rest directly on eggs on any pallet. The plan answers and errors are the same. See Stacking rules, in a job.
  • Nothing else about the job changes. It queues, polls, fails and exports exactly as a load-planning job does, and GET /jobs/{id} echoes the problemType back.
  • Example clients: this job as a Python and a Node program that prints the build sheet.
  • Anatomy of a job: every key of the request, for both problem types.
  • Constraints: stacking and rotation per cargo line, which settle the build order.
  • Limits & quotas: the monthly quota and the per-job ceilings, per problem type.
  • Stacking rules: cargo classes and the rules about what may rest on what, which apply on a pallet too.