rectangleguillotine: add BinPackingCuttingCost objective#436
Open
fontanf wants to merge 1 commit into
Open
Conversation
0b3b6d1 to
b6362ee
Compare
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.
b6362ee to
9ff55dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.