Tasks/Operations Research/Combinatorial Optimization

Cut the glass order out of as few plates as possible

Cut glass orders from the fewest stock plates on a guillotine line

roadef_glass_cutting Operations Research Combinatorial Optimization
instruction.mdthis is what the agent is given

You run the cutting floor of a flat-glass plant. Orders arrive as a batch of rectangular glass items, and you cut them out of large rectangular stock plates (6000 x 3210 mm) on a guillotine cutting line. Every cut runs edge to edge, so each plate is carved by a strict pattern of guillotine cuts; the glass also carries defects (bubbles, scratches) that no delivered item may cover. Stock is expensive and the leftover glass you cannot reuse is pure loss, so the whole game is packing the order into the fewest plates with the least wasted area — while honouring the saw's mechanical rules and the order in which finished pieces must come off the line.

Hard Constraints

Each stock plate is W x H = 6000 x 3210 mm. A solution cuts a sequence of plates with an exact 3-staged guillotine pattern (plus an optional 4th trim stage):

  • stage 1 — vertical cuts split a plate into full-height columns ("1-cuts");
  • stage 2 — horizontal cuts split a column into rows ("2-cuts");
  • stage 3 — vertical cuts split a row into items / waste ("3-cuts");
  • stage 4 — an optional final vertical/horizontal trim.

Enforced by the bundled checker (parameters in global_param.csv):

  • items may be rotated 90 degrees; each placed item must fit inside the plate (H = 3210) and avoid every defect rectangle (no overlap at all);
  • 1-cuts are >= 100 and <= 3500 mm apart (min/max column width);
  • 2-cuts are >= 100 mm apart;
  • any waste piece must be >= 20 mm in the cut dimension (minWaste);
  • items belonging to the same stack must be produced in their given sequence order (cross-stack order is free);
  • the rightmost leftover strip of the last plate may be declared a reusable residual and is not counted as waste.

Beyond the cutting rules:

  • Submit an algorithm, not precomputed answers — the grader re-runs your code on instances you have never seen. Do not key on instance names.
  • /app/methods/main/ is what gets graded. Keep the run.sh contract below.
  • Each sealed case runs your run.sh under a wall-clock cap of 40 s. A crash, timeout, malformed output, or a checker-rejected solution forfeits that case entirely.
  • There is no network at run time, on the workbench or in the grader. Python 3 and g++ are available in both; anything else you have to write yourself.

What You Have

  • tools/instances/ — 10 visible instances plus global_param.csv. The sealed instances are different draws from the same distribution.
  • ./checker <idx> — the checker, compiled into the workbench, the same one the grader uses. With <idx>_batch.csv, <idx>_defects.csv, <idx>_solution.csv and global_param.csv in an instances_checker/ subdir it validates the solution and writes logs/<idx>_statistics.csv (validSolution, nPlates, totalGeoLoss, widthResidual). Its error messages pinpoint any violation.
  • python3 selfcheck.py [N] — free and unlimited: runs your run.sh on the first N visible cases, validates and measures each with that same checker, and prints the raw waste per case.
  • methods/main/solution.py — a valid but crude emitter, useful as a reference for the exact tree grammar. It is yours to rewrite or delete.

An instance is three semicolon-separated CSVs. <idx>_batch.csv:

ITEM_ID;LENGTH_ITEM;WIDTH_ITEM;STACK;SEQUENCE
0;234;1827;0;1

<idx>_defects.csv:

DEFECT_ID;PLATE_ID;X;Y;WIDTH;HEIGHT
0;0;2159.0;2893.0;2.0;3.0

global_param.csv gives widthPlates=6000, heightPlates=3210, min1Cut=100, max1Cut=3500, min2Cut=100, minWaste=20, nPlates=100.

What You Submit

Leave your best solver in methods/main/:

  • run.sh (required): invoked once per case as bash run.sh <batch.csv> <defects.csv> <global_param.csv> <out.csv>. Read the three instance CSVs, write your cutting-tree solution to <out.csv>. Any language.
  • build.sh (optional): if present, run once before grading (e.g. to compile a C++ solver). Have run.sh exec the built binary.

The output is the cutting-tree solution.csv: one row per node of the guillotine cut tree, in production order.

PLATE_ID;NODE_ID;X;Y;WIDTH;HEIGHT;TYPE;CUT;PARENT

TYPE is the item id (>= 0) for an item leaf, -1 for waste, -2 for a branch (internal) node, -3 for the final residual. CUT is the stage (0=plate .. 4). PARENT is the parent NODE_ID.

There is no submit step and no per-attempt feedback. Work and self-check for as long as your run window allows, then leave your best run.sh in place.

How It Is Judged

The grader reruns your run.sh on 10 sealed instances you never see — same distribution, held out — and validates and measures every solution with the same checker. The absolute objective for one instance is the wasted area

waste = (used_plate_area) - (total_item_area) - (last-plate residual area)

Lower is better. A checker-rejected, incomplete, or timed-out case is forfeited, so produce a valid solution for every case first, then minimise waste. Scoring is per case and then aggregated, so a case you ignore cannot be carried by a case you optimise.

How the raw waste maps to the final reward is deliberately not disclosed — optimise the waste itself. The starter as shipped is the zero of that scale: submitted unchanged it scores 0.

Metric

mean ref_waste / your_waste over the 10 sealed instances · higher is better

rel(c) = reference solver waste / your waste; a rejected, empty or timed-out case scores rel 0

anchorvisible setheld-outreward
Bshipped greedy starter0.06150.04810.00
Sreproduced reference, 30 s budget1.00000.60
Ureference waste x 0.951.05261.00
normalisation
m <= B0
B < m <= S0.6 * log(m/B) / log(S/B)
S < m <= U0.6 + 0.4 * log(m/S) / log(U/S)
m > U1

m = this run's held-out metric  ·  B = shipped greedy starter  ·  S = reproduced reference, 30 s budget  ·  U = reference waste x 0.95

B=0.0481, S=1.0, U=1.0526; the mid knot is null. The 10 per-case rel values are averaged first, then the mean is mapped once and clamped.

Rollouts

163 minwall clock
$22.92spend
29.2Mtokens
8versions, 8 kept
0 20M 40M 60M 80M 100M $0 $5 $10 $15 $20 cumulative spend on the run self-check mean waste, 10 visible cases, lower better v0 v1 v2 v3 v4 v5 v6 v7
keptrevertedno scoreturning point
  1. v0Shipped baseline: one item per full-height column100,235,034.911 min · $1.91
  2. v1Full rewrite: C++ beam search over item insertions, defect-aware, own verifierInsert items in production order so the stack sequence holds by construction, then beam-search the placements.8,829,642.916 min · $3.40
  3. v2Cost charges only area actually spent; raised rows re-validated for defectsThe open column above the topmost row is still usable, so charge what is spent, not what is reserved.5,171,526.936 min · $7.40
  4. v3Open-row accounting: charge the used width of the topmost row; alpha 0.15 to 0.114,947,789.962 min · $10.82
  5. v4Best-of-2 geometric beam runs; lost-space charge driven by front-item fit; alpha 0.09Tuning moved to 30 self-generated instances: differences under ~6% on the visible 10 were noise.4,935,591.985 min · $13.76
  6. v5Soft slack charge beta=0.15, multithreaded candidates, compact trace, 30 s budget4,702,545.9107 min · $16.92
  7. v6Drop the plate-remainder lost charge; flat defect arrays and defect-free fast path4,644,444.9117 min · $18.64
  8. v7Reduced dedup signature for more beam diversity; safer stack merge above MAXS4,608,492.9161 min · $22.16

v1 alone cut mean waste 11x in 16 min and $3.40; the six versions after it took 145 min and $19 more for a further 1.9x.

On the hidden set

held-out metricreward
shipped greedy starter0.04810.00
reproduced reference, 30 s budget1.00000.60
reference waste x 0.951.05261.00
this run0.99240.5985
66 minwall clock
-spend
-tokens
5versions, 4 kept
20M 40M 60M 80M 100M 0 30 60 90 120 agent step (this harness reports no tokens or timestamps) self-check mean waste, 10 visible cases, lower better v1 v2 v3 v4 v5
keptrevertedno scoreturning point
  1. v1Shipped one-item-per-column baseline100,235,034.9
  2. v2First 3-stage shelf packer; 4th cut spawned 3 children and thin waste7 of 10 valid
  3. v3Isolate defects, flush items for the 4th cut, exact-width and mixed shelvesGet the 3-stage geometry legal first: keep every cut clear of defects and let shelves take exact widths.15,440,958.9
  4. v4Shelf-order search, stack unlock and prefix, shrink a column only if leftovers legalSearch the order the shelves are built in, restart-heavy, instead of packing them in one fixed pass.12,666,555.9
  5. v5Random(12) restart stream finds A11 in 4 plates; more last-plate time12,602,676.9

5 snapshots in 66 min; this harness reports no token or cost data. v4 and v5 solve in 37 s against the grader's 40 s per-case cap.

On the hidden set

held-out metricreward
shipped greedy starter0.04810.00
reproduced reference, 30 s budget1.00000.60
reference waste x 0.951.05261.00
this run0.43950.4374
18 minwall clock
$1.08spend
5.7Mtokens
4versions, 4 kept
20M 40M 60M 80M 100M $0 $0.2 $0.5 $0.8 $1 cumulative spend on the run self-check mean waste, 10 visible cases, lower better v0 v1 v2 v3
keptrevertedno scoreturning point
  1. v0Shipped one-item-per-column baseline100,235,034.93 min · $0.21
  2. v1Multi-item-per-column DP packing with defect-aware cut avoidanceFill a column by DP over the stack heads instead of one item, skipping any cut that lands on a defect.12,842,463.98 min · $0.58
  3. v2Column-level defect filtering and candidate pruning, K=612,362,247.913 min · $0.80
  4. v3Candidate pruning widened to K=712,277,824.917 min · $1.02

4 snapshots in 18 min for $1.08. v1 did all of the work; the two pruning versions after it took a further 4.4%.

On the hidden set

held-out metricreward
shipped greedy starter0.04810.00
reproduced reference, 30 s budget1.00000.60
reference waste x 0.951.05261.00
this run0.35540.3955
223 minwall clock
$75.11spend
118.7Mtokens
62versions, 35 kept
20M 40M 60M 80M 100M $0 $20 $40 $60 cumulative spend on the run self-check mean waste, 10 visible cases, lower better v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33 v34 v35 v36 v37 v38 v39 v40 v41 v42 v43 v44 v45 v46 v47 v48 v49 v50 v51 v52 v53 v54 v55 v56 v57 v58 v59 v60 v61
keptrevertedno scoreturning point
  1. v0Shipped one-item-per-column baseline100,235,034.91 min · $0.15
  2. v1Defect-aware ordered column packer: stack merge, five priorities, row beamMerge the stacks into one order first, then pack columns off that order so the sequence holds without search.58,018,398.99 min · $1.11
  3. v2Event-width defect avoidance, same-plate column splitting, defect-edge x shifts28,030,899.913 min · $1.99
  4. v3True multi-item stage-2 shelves packed against each plate's defects, 15 variantsCut real multi-item shelves and build them against each plate's actual defects instead of repairing a dense shelf afterwards.19,185,744.930 min · $5.54
  5. v4Enable the last two row-selection policies, 25 direct shelf variants18,897,486.932 min · $6.07
  6. v5Stage-1 split grid widened to every 100 mm from 2500 to 3500, 55 variants17,852,631.934 min · $6.80
  7. v6Stage-1 split grid refined to 50 mm spacing, 105 variants17,454,591.937 min · $7.85
  8. v7Repurpose two redundant row policies: max row area, most items advanced17,273,226.941 min · $8.89
  9. v825 mm split spacing for the dominant density policy, 50 mm for the rest17,084,799.943 min · $9.74
  10. v9Coarse adaptive path picks split and policy per plate by packed item areaLet each plate choose its own split and policy by packed area instead of fixing one layout for the whole batch.14,532,207.947 min · $11.04
  11. v10Adaptive per-plate split spacing refined from 200 mm to 100 mm13,446,585.950 min · $12.04
  12. v11Drop a never-winning fixed policy; second coarse grid only under 180 items13,405,818.954 min · $13.45
  13. v12Prune the redundant direct policy instead of the fallback; halve large-batch grid13,385,595.957 min · $14.66
  14. v13Width-2 plate-level beam over coarse adaptive transitions13,277,418.962 min · $16.43
  15. v14Plate-level beam widened from 2 to 3 states13,277,418.965 min · $17.40
  16. v15Beam's second survivor by highest item count instead of second-highest areaA14 worse, A17 tied66 min · $17.87
  17. v16Fixed defect-snapped three- and four-column shelf schemes under 180 items13,238,577.969 min · $18.84
  18. v17Fine adaptive path may pick four defect-snapped three-column schemes per plate12,437,040.972 min · $19.97
  19. v18Asymmetric 1500/1800/2250/2400 three-column and four-column schemes12,112,509.975 min · $21.20
  20. v19Expanded 3/4-column scheme set enabled through 400 items; coarser fixed grids11,801,460.979 min · $22.81
  21. v20Four three-column transitions added to the plate-level beam under 180 items3 cases, all tied80 min · $23.32
  22. v21Hybrid adaptive path under 180 items pooling all four fill heuristics11,782,842.985 min · $25.40
  23. v22Adaptive path ranking each plate by item count before packed area8 cases, all tied88 min · $26.42
  24. v23Bounded final-two-plate repack over the top four penultimate states11,755,878.997 min · $29.91
  25. v24Tail-repack penultimate survivors widened from 4 to 84 cases, all tied99 min · $32.41
  26. v25Tail-repack two-column splits refined to a full 100 mm grid4 cases, all tied100 min · $33.15
  27. v26Width-16 precedence-aware beam inside every row instead of greedy fill2 cases tied, A11 39.9 s104 min · $34.54
  28. v27Width-4 rich structural plate beam for batches under 100 itemsA11 over 50 s106 min · $35.49
  29. v28Memoized direct-column transitions with defensive cloning3 cases tied, 74 s108 min · $36.31
  30. v29Retry memoization with shared immutable columns, cloning six mutation sites3 cases tied, 72 s111 min · $38.55
  31. v30Rich uniform and mixed completion searches when the last two plates fit oneall 10 tied v23119 min · $42.04
  32. v31Stage-4 splits a stage-3 slot into two ordered items of equal oriented width11,741,112.9130 min · $47.22
  33. v32Paired adaptive path expanded to the full asymmetric 3/4-column setA9 worse131 min · $47.77
  34. v33Mixed-policy adaptive path: each column picks the best of four row heuristics11,374,530.9142 min · $49.25
  35. v34Prune policy trials by column role: first, middle and final columns differtied v33, suite 126 s150 min · $50.03
  36. v35Drop fixed-width trajectories above 180 items, keep six policy-0 fallbacksA14 tied, 28 s153 min · $50.66
  37. v36Pair-aware tail completion plus a per-column policy beam and three-to-twoA14 tied162 min · $52.33
  38. v37Second large-instance trajectory selecting plates by item count firstA14 tied, 33 s164 min · $52.60
  39. v38Global stage-4 pair candidate cutoff raised from 70 to 90 itemsA18, A11 tied166 min · $53.10
  40. v39Adaptive two-column widths offset 50 mm from the existing 100 mm grid5 cases, all worse168 min · $53.48
  41. v40Separate mixed-policy trajectory over the full 2/3/4-column set under 75 items11,251,587.9172 min · $54.48
  42. v41Expanded mixed-structure trajectory cutoff raised from 75 to 180 items11,167,806.9174 min · $55.05
  43. v42Width-3 plate-level beam over expanded mixed structures under 75 items11,145,978.9177 min · $55.81
  44. v43Mixed plate beam extended to 90 items with two states in the 76-90 band11,136,348.9180 min · $56.81
  45. v44Optimized width-2 mixed beam extended from 90 to 180 itemsA8 tied181 min · $57.14
  46. v45Small-batch mixed plate beam raised from three to four frontier states11,090,445.9183 min · $57.84
  47. v46Small-batch mixed plate beam raised from four to six frontier statesA18, A4 tied184 min · $58.24
  48. v47Fourth beam state swapped from area-ranked to highest item countA18 worse186 min · $58.67
  49. v48Width-2 plate-level beam around the stage-4 pair packer under 70 items11,070,543.9188 min · $59.34
  50. v49Pair-aware plate beam raised from two to three frontier states3 cases, all tied189 min · $59.83
  51. v50Pair-aware beam over the full expanded 2/3/4-column structure set5 cases, no gain191 min · $60.57
  52. v51Exact shelf-partition and orientation DP for one-stack orders of 12 items11,038,443.9193 min · $61.78
  53. v52Exact shelf DP generalized to a last-plate post-optimizerA17 tied195 min · $62.55
  54. v53Width-4 mixed beam allowing all four row policies in every column11,031,381.9198 min · $64.27
  55. v54All-policy mixed beam raised from four to six frontier statesA4 tied, A18 worse200 min · $64.86
  56. v55Large-batch beam enriched with seven balanced structures, policies 0/1/311,015,331.9201 min · $65.50
  57. v56Large-batch beam widened to width 3, then two unused structures prunedA14 worse, 36 s204 min · $66.56
  58. v57Retry width-3 large beam, dropping all six dominated direct fallbacksA14 gain, 38 s205 min · $67.10
  59. v58Exact last-plate optimizer for tails of 6 items from at most 3 stacks10,904,586.9216 min · $71.58
  60. v59Exact shelf breaks for 7-10-item tails, cross-stack order frozenA4, A17 tied218 min · $72.43
  61. v60Exact tiny-tail geometry retention cut from four states to twoA16 worse219 min · $72.94
  62. v61Exact tiny-tail geometry retention cut from four states to three3 cases tied v58221 min · $73.95

62 snapshots in 223 min for $75.11; 28 were focused probes and reverted. On the sealed set A15 and A2 returned nothing and scored rel 0.

On the hidden set

held-out metricreward
shipped greedy starter0.04810.00
reproduced reference, 30 s budget1.00000.60
reference waste x 0.951.05261.00
this run0.34710.3908
51 minwall clock
$9.39spend
12.3Mtokens
27versions, 17 kept
20M 40M 60M 80M 100M $0 $2 $4 $6 $8 cumulative spend on the run self-check mean waste, 10 visible cases, lower better v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26
keptrevertedno scoreturning point
  1. v0Shipped one-item-per-column baseline100,235,034.91 min · $0.22
  2. v1Deterministic stack-head shelf packer, two 3000 mm columns, defect-aware gapsPack shelves off the head of each stack, so the sequence constraint is satisfied without any search.33,506,838.94 min · $0.52
  3. v2Fixed column width 3000 to 2000 mm, three columns per plate36,074,838.94 min · $0.58
  4. v3Charge shelf height growth across the full 3000 mm width to cluster heights49,877,838.95 min · $0.73
  5. v435 randomized near-best multi-starts, keep the plan using the fewest columnsSame greedy, many seeds: pick the best plan out of a batch instead of the first one it builds.29,654,838.97 min · $1.01
  6. v5Multi-start count 35 to 25025,802,838.97 min · $1.08
  7. v6Multi-start count 250 to 1000, 150 above 500 items23,876,838.98 min · $1.18
  8. v7Shrink the last plate's final column to the tightest legal width23,398,869.99 min · $1.35
  9. v8Deeper top-8 exploration with randomized early shelf closure25,697,229.910 min · $1.49
  10. v9Add 500 early-close starts on top of the original 100023,398,869.912 min · $1.76
  11. v10Standalone 1000-start search using 2000 mm columns only25,054,266.913 min · $1.88
  12. v11Portfolio of 3000 and 2000 mm geometries, chosen by exact used widthOne plate geometry suits one batch and not the next; run several and let the measured used width decide.22,768,104.915 min · $2.24
  13. v12Add a 1500 mm-column portfolio searchA8 ran over18 min · $2.66
  14. v13Rank restarts by exact post-shrink last-column width, not first fewest-column plan21,827,574.919 min · $2.87
  15. v14Add 250 deep-exploration starts per column geometryno change measured21 min · $3.12
  16. v15Exact-height shelves, no mandatory 20 mm trim, reject 1-19 mm item gaps4 cases only22 min · $3.32
  17. v16Mixed 3500/2500 layouts with defect-safe stage-1 and stage-2 cut boundaries21,590,997.927 min · $3.96
  18. v17Defect-safe portfolio: 1000 starts per plain layout, 500 per mixed layout21,213,180.929 min · $4.30
  19. v18Mixed-layout searches raised from 500 to 750 starts each20,932,626.931 min · $4.82
  20. v19Standalone 750-start 3200/2800 layout search3 cases only33 min · $5.13
  21. v20Six-layout portfolio with per-layout restart budgets and size scaling20,566,365.938 min · $6.02
  22. v21Harden shrunk residual boundaries against defects; restarts scale by items x defectsunchanged from v2041 min · $6.96
  23. v22Swap the 2000 mm search for a 150-start 3300/2700 pair; 3500/2500 cut to 60020,493,819.947 min · $8.57
  24. v23Standalone 150-start 3400/2600 pair6 cases only48 min · $8.71
  25. v24Standalone 150-start 3100/2900 pair6 cases only48 min · $8.84
  26. v25Standalone 150-start 2500/1750/1750 three-column permutations6 cases, A9 invalid50 min · $9.08
  27. v26Force residual width to 0 or at least minWaste in ranking and final tighteningunchanged from v2251 min · $9.24

27 snapshots in 51 min for $9.39. Pure Python throughout, so most versions only bought more restarts. Slowest visible case 33.9 s against a 40 s cap.

On the hidden set

held-out metricreward
shipped greedy starter0.04810.00
reproduced reference, 30 s budget1.00000.60
reference waste x 0.951.05261.00
this run0.19800.2797