Skip to content

Choosing a strategy

The public v1 service contract accepts five strategy values. Hosted default is alns. alnsStripe defaults to stripeObjective: dual. glass races greedy / alns / alnsStripe / genetic in parallel and picks the best packing (plus dual nesting). Use greedy when latency matters more than search.

Pick by time budget and by which layout objective you need.

TL;DR

Strategy Time budget Quality profile Best for
greedy Low latency Fast baseline Live previews; opt-in (not hosted default)
alns Higher latency Classic SA destroy/repair on the cut tree Waste-sensitive packing, batch optimization
alnsStripe Shop-scale wall (often 10–60 s) Stripe / nesting portfolio; optional dual output Glass-style maps: nesting L1 vs min sheets
glass Same wall as the slowest clone (parallel) Parallel greedy + alns + alnsStripe(dual) + genetic; pick production packing; nesting from stripe Shop config when you do not want to choose a method; opt-in, not hosted default
genetic Opt-in Band decoder + order search Experiments; not the hosted default

alns and alnsStripe are different engines. Do not mix their KPIs.

Greedy

Use greedy when latency matters more than squeezing out the last few percent of utilization. Hosted clients that omit strategy get alns, not greedy.

{ "strategy": "greedy" }
  • Fastest path through the public API.
  • Opt-in for interactive / quote UX.
  • Minimal configuration surface.

ALNS (alns)

Hosted default when strategy is omitted. Use a shorter alnsConfig.timeLimitMs for interactive calls; omit config → 10000 ms.

{
  "strategy": "alns",
  "alnsConfig": {
    "maxIterations": 250,
    "timeLimitMs": 250,
    "numThreads": 1,
    "seed": 42
  }
}
  • Adds an explicit optimization budget.
  • Supports seeded runs for reproducibility.
  • Can return top-level alnsStats in the response.
  • Defects: sheets[].defects honored by greedy and alns.

Stripe ALNS (alnsStripe)

Use alnsStripe when the job cares about glass-style strip maps (DumpMaps L1 / depth) as well as sheet count.

{
  "strategy": "alnsStripe",
  "alnsConfig": {
    "timeLimitMs": 10000,
    "numThreads": 0,
    "seed": 42,
    "stripeObjective": "dual"
  }
}
  • stripeObjective: dual (default) | nesting | packing.
  • dual keeps an L1-safe nesting layout in result and, when packing uses fewer sheets, returns that candidate in alternatives[].
  • Product thin by default (enableStripeResearchOps: false). Research neighbourhoods are opt-in.
  • Not a drop-in rename of alns: different search space and accept rules.

Glass portfolio (glass)

Opt-in shop orchestration. Runs greedy, alns, alnsStripe (stripeObjective: dual), and genetic in parallel on one wall (timeLimitMs is shared; wall ≈ the slowest clone, not 4×). Picks packing by production lex (unplaced / new-standard sheets / sheet count / waste). Dual nesting stays primary unless packing is strictly better on that lex (for example remnant + N standards versus N+1 new standards at the same sheet count). If nesting stays primary and packing used fewer sheets, that candidate is in alternatives[].

If timeLimitMs ≥ 5000, glass raises a small maxIterations / maxNoImprove (console Fast/Normal 40/250) so search stops on the wall, not after a few hundred iterations. Greedy still finishes in milliseconds; leftover wall is already available to the other clones because they run at the same time. Hosted default alns (10 s, omit config) does not apply this fill.

{
  "strategy": "glass",
  "alnsConfig": {
    "timeLimitMs": 60000,
    "numThreads": 0,
    "seed": 42
  }
}
  • Not the hosted default. Omit strategy still → alns.
  • Does not copy secondary layouts from other jobs.
  • Inner clones share the machine: numThreads 1 stays 1; 0 or >1 → max(1, cores/4) each so four engines do not take all cores four times.
  • Response alnsStats.portfolioWinner names the packing clone (greedy | alns | alnsStripe | genetic).

Genetic (opt-in)

{ "strategy": "genetic" }

Band-order search. Not promoted as the hosted quality default. See the public API contract.

Practical rule

  • Omit strategy → hosted default alns (W4 D3). Default ALNS wall is alnsConfig.timeLimitMs (10000 ms if omitted).
  • Send strategy: "greedy" when the caller is waiting on screen.
  • Use alnsStripe (default stripeObjective: "dual") when nesting map quality and min-sheets must both be visible.
  • Use glass when you want the solver to race greedy, alns, alnsStripe, and genetic and keep the best packing + dual nesting.
  • Kerf canon: params.kerfWidth. Margins canon: sheets[].margin*. See public API contract.