Skip to content

rectangleguillotine: add BinPackingCuttingCost objective#436

Open
fontanf wants to merge 1 commit into
masterfrom
feature/bin-packing-cutting-cost
Open

rectangleguillotine: add BinPackingCuttingCost objective#436
fontanf wants to merge 1 commit into
masterfrom
feature/bin-packing-cutting-cost

Conversation

@fontanf

@fontanf fontanf commented Jul 5, 2026

Copy link
Copy Markdown
Owner

New objective minimizing total cutting cost (a fixed cost plus a cost proportional to length, per cutting stage, plus a bin cost proportional to area) instead of number of bins. Only the tree_search algorithm supports it; other algorithms are explicitly disabled for this objective in optimize().

Costs are stored in Parameters::cutting_costs, indexed by stage number (index 0 is the bin, index s is the s-cut), sized to number_of_stages + 1 (bin) + 1 more if cut_type is NonExact or Roadef2018 (which allow an extra cut at the deepest level). InstanceBuilder::build() validates that every required entry has been set.

tree_search's Node::cutting_cost mirrors the existing bincurr_number_of_1_cuts / subplate1curr_number_of_2_cuts cascades, extended to depths 3 and 4 with the same potential/confirmed cut tracking, combining each cut's fixed and variable cost into a running total instead of tracking count and length separately. For 2-staged instances, the existing x1-pinned-to-full-width trick means depth 1 doesn't correspond to a real cut, so the effective cutting costs are shifted accordingly.

Solution::cutting_cost() independently recomputes the same total from the final guillotine tree for reporting.

@fontanf fontanf force-pushed the feature/bin-packing-cutting-cost branch from 0b3b6d1 to b6362ee Compare July 5, 2026 20:45
New objective minimizing total cutting cost (a fixed cost plus a cost
proportional to length, per cutting stage, plus a bin cost proportional to
area) instead of number of bins. Only the tree_search algorithm supports it;
other algorithms are explicitly disabled for this objective in optimize().

Costs are stored in Parameters::cutting_costs, indexed by stage number
(index 0 is the bin, index s is the s-cut), sized to number_of_stages + 1
(bin) + 1 more if cut_type is NonExact or Roadef2018 (which allow an extra
cut at the deepest level). InstanceBuilder::build() validates that every
required entry has been set.

tree_search's Node::cutting_cost mirrors the existing
bincurr_number_of_1_cuts / subplate1curr_number_of_2_cuts cascades,
extended to depths 3 and 4 with the same potential/confirmed cut tracking,
combining each cut's fixed and variable cost into a running total instead
of tracking count and length separately. For 2-staged instances, the
existing x1-pinned-to-full-width trick means depth 1 doesn't correspond to
a real cut, so the effective cutting costs are shifted accordingly.

Solution::cutting_cost() independently recomputes the same total from the
final guillotine tree for reporting.
@fontanf fontanf force-pushed the feature/bin-packing-cutting-cost branch from b6362ee to 9ff55dc Compare July 5, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant