Repository navigation
irregular: add the fixed items to the solutions with SolutionBuilder::add_fixed_item - #836
Merged
Merged
Conversation
…:add_fixed_item Replace the 'is_fixed' argument of SolutionBuilder::add_item by an 'add_fixed_item' method which takes the position of the fixed item in the bin type, and store this position in the solution items. The certificates store it as 'fixed_item_pos', so that the fixed items of a certificate are still fixed once it is read.
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.
Follow-up of #835: the fixed items of a certificate were read as packed items, so writing then reading a solution lost them.
Instead of matching the items of a certificate with the fixed items of the bin types, the solutions now know which fixed item each of their fixed items is:
SolutionItem::is_fixedis replaced bySolutionItem::fixed_item_pos, the position of the item in the fixed items of the bin type, or -1 (is_fixed()is kept as an accessor, and as a read-only property in Python).is_fixedargument ofSolutionBuilder::add_itemis removed. The newSolutionBuilder::add_fixed_item(bin_pos, fixed_item_pos)takes the item type, position, angle and mirror from the bin type; it throws for an invalid position or a fixed item already added to the bin.fixed_item_posfor the fixed items, andSolutionBuilder::readadds them withadd_fixed_item. The solution files of the tests with fixed items are updated (only the new key is added), and the certificate format is documented.Changes in the algorithms:
add_fixed_item. The direct trigonometry separator no longer keeps a copy of the fixed items, and the items of the separation models storefixed_item_posinstead of a boolean.Tests:
Irregular.SolutionBuilderAddFixedItemandIrregular.SolutionWriteReadFixedItems. All the irregular tests pass.The other problem types have a
BinType::fixed_itemsfield, but nothing fills it yet, so they are unchanged.