CutSolver icon indicating copy to clipboard operation
CutSolver copied to clipboard

group equal required and stocks

Open ModischFabrications opened this issue 10 months ago • 2 comments

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.

ModischFabrications avatar Apr 12 '24 08:04 ModischFabrications

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.

ModischFabrications avatar Apr 12 '24 09:04 ModischFabrications

extension of #71

ModischFabrications avatar Apr 12 '24 09:04 ModischFabrications