Description
Generate integer piece lengths and demands for unlimited identical stock lengths, with an exact-demand first-fit cutting witness; zero kerf and no stock-count optimality claim.
An optimization instance defines choices, constraints, and an objective. A feasible witness demonstrates that its stated constraints can be met; it establishes optimality only when the tool actually computes and verifies an optimum.
Generate integer piece lengths and demands for unlimited identical stock lengths, with an exact-demand first-fit cutting witness; zero kerf and no stock-count optimality claim.
When to use this tool
Use this generator to create reproducible cutting stock instance cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply typeCount, stockLength, minimumLength, maximumLength, minimumDemand, maximumDemand in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read stockLength, pieceTypes, stocks, stockCount. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.
Draw piece lengths and integer demands, expand demanded pieces in type order, and place each in the first existing stock with enough remainder or open a new stock. Return piece-type indexes, used lengths, waste, and stock count.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| typeCount | Type Count | Required. Safe integer; minimum 1; maximum 32. |
| stockLength | Stock Length | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| minimumLength | Minimum Length | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| maximumLength | Maximum Length | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| minimumDemand | Minimum Demand | Required. Safe integer; minimum 1; maximum 64. |
| maximumDemand | Maximum Demand | Required. Safe integer; minimum 1; maximum 64. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| stockLength | Stock Length | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| pieceTypes | Piece Types | Required. Array of Object; no unknown keys.; minimum items 1; maximum items 32. |
| pieceTypes[].length | Length | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| pieceTypes[].demand | Demand | Required. Safe integer; minimum 1; maximum 64. |
| stocks | Stocks | Required. Array of Object; no unknown keys.; minimum items 1; maximum items 512. |
| stocks[].pieces | Pieces | Required. Array of Safe integer; minimum 0; maximum 31.; minimum items 1; maximum items 512. |
| stocks[].used | Used | Required. Safe integer; minimum 1; maximum 9007199254740991. |
| stocks[].waste | Waste | Required. Safe integer; minimum 0; maximum 9007199254740991. |
| stockCount | Stock Count | Required. Safe integer; minimum 1; maximum 512. |
| randomness | Replay source and normalized 32-bit seed, or null seed for an advancing context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional safe-integer replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"typeCount": 3,
"stockLength": 20,
"minimumLength": 3,
"maximumLength": 9,
"minimumDemand": 1,
"maximumDemand": 3,
"seed": 42
},
"output": {
"stockLength": 20,
"pieceTypes": [
{
"length": 7,
"demand": 2
},
{
"length": 8,
"demand": 3
},
{
"length": 4,
"demand": 2
}
],
"stocks": [
{
"pieces": [
0,
0,
2
],
"used": 18,
"waste": 2
},
{
"pieces": [
1,
1,
2
],
"used": 20,
"waste": 0
},
{
"pieces": [
1
],
"used": 8,
"waste": 12
}
],
"stockCount": 3,
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- Every possible piece length must fit stockLength and expanded demand is bounded. This first-fit witness is not minimum stock usage and omits kerf, cutting constraints, material defects, and physical safety.
- A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random Chinese Postman Instance Generator
Generate a connected undirected nonnegative-integer-weight graph and depot for a Chinese postman optimization problem, without claiming an optimal route.
- Random Binary Constraint Satisfaction Instance Generator
Generate a finite-domain binary extensional CSP with distinct variable pairs and a planted satisfying assignment; other tuples are independently included, without uniqueness or hardness claims.