Optimization objectives
Every solve optimizes toward configuration.objective, the primary objective that defines what "best" means, plus an optional secondaryObjectives[] list that refines the result without changing what "best" means. This API supports exactly one primary objective and two independent secondary objectives, so this page is the one to check before you build any objective-picking UI.
When to use this
- You want to know what
configuration.objectiveactually controls, and what happens if you set anything other than the one supported value. - A plan came back differently than you expected and you want to know whether the objective (not a constraint) is the cause.
- You want
CenterLoadMassorconsolidationto refine the plan and want to know how they combine and what they cost you in the request.
The primary objective
configuration.objective supports exactly one value: "MinimizeCarriers". It fixes the cargo (every item must ship) and keeps the number of carriers down where you leave the count open: an entry without a quantity gets instances added only until the cargo runs out or the carrier fits nothing more, and an entry with a quantity comes back in full (see What quantity means). Entries are used in the order you list them, so the count is kept down within that order rather than across every entry (see The order of carriers). Leftovers in unplacedItems mean the cargo genuinely doesn't fit even using every carrier you made available. The solver never drops cargo to save a trip.
Omitting the field, or sending null or "", all mean the same thing: MinimizeCarriers. Any other value is rejected with a 400, including "MaximizeFill"; see Not supported.
What quantity means
carriers[].quantity is the maximum number of that type available: never a fill target, and never a count the solver is asked to reach. Leave it out (or send null) and the entry is unlimited: instances are added until the cargo runs out or the carrier fits nothing more, so only the instances used come back. An explicit quantity: 3 puts all three instances in the result's carriers[], and an instance that ends up holding nothing comes back with an empty placements[].
Every carrier in the plan counts. Carriers never nest, so there are no intermediate carriers to exclude from the count: each entry in the result's carriers[] is one carrier, and the plan uses it when its placements[] is not empty (summary.carriersUsed counts those).
The order of carriers
Carrier entries are tried in the order you list them in carriers[]. Each is used, up to its quantity, before the next one is tried, so an unlimited entry takes all the cargo it can carry and a later entry gets only what is left. MinimizeCarriers keeps the count down within that order, not across every entry: list the carrier you would rather use first. Group separation can make one exception; see Separating groups along the carrier. The result's carriers[] follows the same order.
Secondary objectives
An optional secondaryObjectives[] list adds either or both of two independent behaviors on top of the primary:
| Type | What it does |
|---|---|
CenterLoadMass |
Centres the load's mass in a pass run after the solve. |
consolidation |
Chooses the axis the solver packs along, via a signed direction: -X, -Y or Z. |
{
"configuration": {
"secondaryObjectives": [
{ "type": "CenterLoadMass" },
{ "type": "consolidation", "direction": "-Y" }
]
}
}
At most one entry per type is accepted: a second consolidation entry, or a duplicate CenterLoadMass, is a 400, not last-one-wins. A direction is required on consolidation and limited to -X, -Y or Z: +X and +Y are rejected with a 400. A direction sent alongside CenterLoadMass is accepted and ignored.
Three consequences follow directly from how these behave, and are worth being explicit about:
- Order does not matter.
CenterLoadMassandconsolidationare two independent, deterministic switches, not an ordered list of tie-breakers that gets applied step by step. Don't build a reorderable list for this field; a pair of independent toggles is the right UI. toleranceis rejected. Sendingconfiguration.toleranceat all (including0) returns a400; see Not supported.- Consolidation can't be switched off, only redirected. The solver always packs along an axis; the default is
-X, exactly as if you had sent{ "type": "consolidation", "direction": "-X" }. Leavingconsolidationout of the list is not "no consolidation"; it's consolidation toward-Xby default. Present this to users as a choice among three axes, not as an on/off toggle.
Where the load ends up
What the direction changes is which face the load is held against. All three gather it toward the carrier's origin corner (x = 0, y = 0, z = 0) and fill outward from there, which is why there is no +X or +Y: the solver cannot gather a load toward the opposite end.
The same 18 items in the same carrier under each of the three directions:
-Xholds them against thex = 0end,-Yagainst they = 0side,Zon the floor. Whatever the load does not need stays clear.
Hard limits always win
With one primary objective and two secondary switches, there isn't much left for a hard limit to override, but three still bind no matter what configuration says:
- Carrier dimensions. Cargo that doesn't physically fit inside a carrier's geometry can't be placed there; it goes to
unplacedItemsinstead of being forced in. - A carrier's
maxWeight. When a carrier entry has one, the cargo weight placed on each of its carriers never goes past it; what does not fit moves on to the next carrier (another of the same entry while itsquantityallows, then the next entry) or is left inunplacedItems. Without amaxWeightnothing caps the weight, so state one for a vehicle with a legal payload. - The plan's limits. Exceeding the account's item/carrier/carrier-instance ceilings returns
422; hitting the concurrent-job or monthly-quota ceiling returns429. Both apply to every job regardless of the objective or secondary objectives you set. See Limits & quotas.
CenterLoadMass centres the mass that is loaded; a maxWeight caps how much of it a carrier carries.
Key fields
| Field | Where | Purpose |
|---|---|---|
configuration.objective |
request | The only supported primary: MinimizeCarriers. Also the default when omitted. |
configuration.secondaryObjectives |
request | Independent switches, at most one per type: CenterLoadMass, consolidation (with a direction). |
configuration.tolerance |
request | Rejected: any value returns a 400. See Not supported. |
Related
- Constraints: the hard stacking/separation rules objectives never override.