CutSolver
CutSolver copied to clipboard
Weight equally good solutions by some metric
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.
- Most cuts of the same length in a row
- largest trimmings at once / largest distribution of trimmings
- ..?
Only relevant for bruteforce! Other solvers won't look for other solutions
For #52 : Could prioritize solutions that use less infinite material with equal trimmings
#52: Sort by fewest leftovers, e.g. with a min_cutoff_length or similar.
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.
nice to have: smarter ratings based on weights:
- Equal stocks higher than <10% trimmings difference
- the number of cuts
- infinite
- 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.