ModischFabrications / CutSolver

Webservice to determine ideal cut placement on stocks
https://cutsolver.modisch.me
GNU Lesser General Public License v3.0
31 stars 6 forks source link

group equal required and stocks #73

Open ModischFabrications opened 3 months ago

ModischFabrications commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

extension of #71