CutSolver
CutSolver copied to clipboard
group equal required and stocks
Current implementation will ignore content during iteration and try to generate permutations for multiple entries for the same length. Combining all entires would make some parts of the code easier and n_combinations more accurate.
[500:1, 500:2, 500:4] => [500:7]
Might be good to do that during assignment rather than during every access.
something like this, but for INS and QNS:
def group_QNS(entries: Collection[QNS]) -> Collection[QNS]:
g = [QNS(length=e[0].length, quantity=e[1]) for e in groupby(entries, key=lambda x: x.length)]
return g
See https://docs.pydantic.dev/latest/concepts/validators/#before-after-wrap-and-plain-validators for assignment checks.
extension of #71