Confectionery piece and cavity matching calculator

Calculate piece-to-cavity assignment and unboxed pieces with your own figures.

Your numbers

Use the units shown. Results update as you change valid inputs.

Use piece-to-cavity assignment and unboxed pieces to compare changes to your inputs. The method and limits below explain the scope.

Examples

Examples

Try the starting example

Piece types [width mm,length mm,count]; enter JSON
[[20,30,2],[35,35,1]]
Cavity types [width mm,length mm,count]; enter JSON
[[25,35,2],[40,40,1]]
Piece-to-cavity assignment (JSON)
[[1,1],[1,1],[2,2]]
Unboxed pieces (count)
0

Try another scenario

Piece types [width mm,length mm,count]; enter JSON
[[25,30,3],[30,30,1]]
Cavity types [width mm,length mm,count]; enter JSON
[[30,30,2],[35,35,1]]
Piece-to-cavity assignment (JSON)
[[1,2],[1,1],[1,1],[2,null]]
Unboxed pieces (count)
1
Calculation method

Calculation method

Piece-to-cavity assignment (JSON)

Expand piece counts; maximum bipartite match to cavity type capacities using axis-aligned 0/90-degree fits.

Unboxed pieces (count)

Number of piece units without a compatible cavity.

Symbols and units
a
Piece types [width mm,length mm,count]; enter JSON
b
Cavity types [width mm,length mm,count]; enter JSON

Use the units shown. A list keeps the order in which you enter its values. The symbol ^ means “raised to the power of”.

Assumptions & limits

Assumptions & limits

  • One rectangular piece per rectangular cavity, 90-degree rotation allowed; depth and irregular shapes excluded. Supported limits: All numeric inputs and computed intermediates must remain finite. Supported numeric input magnitude is zero or 1e-12 through 1e12 in absolute value; reject values outside this bounded range. All lists/JSON record tables are limited to 100 records unless a stricter bound is stated; reject malformed record arity and wrong member types. Positive dimensions; counts nonnegative integers; total pieces and cavities <=100. This is cavity compatibility, not a new box partition or food-contact approval.
Are these inputs private?

These calculations run in your browser. A shared link contains the values you choose to share. Only questions submitted to the separate AI finder are sent to OpenAI.

Share this page
Share this calculator

Leave unchecked to share the page without your entered values.