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

Weight equally good solutions by some metric #68

Open ModischFabrications opened 5 months ago

ModischFabrications commented 5 months ago

There are often solutions with identical trimmings. Current code just picks one at random, but there could be a setting to prioritize based on secondary metrics.

  1. Most cuts of the same length in a row
  2. largest trimmings at once / largest distribution of trimmings
  3. ..?
ModischFabrications commented 5 months ago

Only relevant for bruteforce! Other solvers won't look for other solutions

ModischFabrications commented 5 months ago

For #52 : Could prioritize solutions that use less infinite material with equal trimmings

ModischFabrications commented 5 months ago

52: Sort by fewest leftovers, e.g. with a min_cutoff_length or similar.

ModischFabrications commented 4 months ago

Side-effect of trimming only solvers, can't really be caught at the moment:

required = [500:1, 100:1] stocks = [900, 100:1]

A human would just pick the 100 stock and pass it on, but the solver is going to use 500+100 to minimize trimmings. This is mathematically more efficient because 300 trimmings with 1 stock is less than 400 trimmings on 2.

Future solvers could optimize for number of cuts and/or have adaptive weights based on {longest trimming, sum of trimmings, number of cuts, ...} instead, which would catch this, but could potentially leave more (but more usable) trimmings.

ModischFabrications commented 4 months ago

nice to have: smarter ratings based on weights:

  1. Equal stocks higher than <10% trimmings difference
  2. the number of cuts
  3. infinite
  4. pattern reuse, ...
Bad solution

``` { "job": { "cut_width": 20, "stocks": [ { "length": 2400, "name": "138200", "quantity": 1 }, { "length": 6000, "name": "138318", "quantity": 1 } ], "required": [ { "length": 1820, "quantity": 1 }, { "length": 666, "quantity": 3 } ] }, "solver_type": "bruteforce", "time_us": 473, "layout": [ { "stock": { "length": 2400, "name": "138200" }, "cuts": [ { "length": 666 } ], "trimming": 1714 }, { "stock": { "length": 6000, "name": "138318" }, "cuts": [ { "length": 1820 }, { "length": 666 }, { "length": 666 } ], "trimming": 2788 } ] } ```

-> In the result both stock items are used, where it would be more efficient if all items were cut from the second stock item. It doesn't make a difference in waste, but a lot in handling.