下料 / 装箱分配
把一批零件分配到若干根原料 / 货箱上,使各料负载尽量均衡、减少浪费。与一维下料、多机调度、负载均衡同属一类装箱问题。
请求参数
| 字段 | 说明 |
|---|---|
| problem | "cutting_stock" |
| pieces | 零件尺寸数组,如 [3, 5, 7, 2, 4] |
| bins | 原料 / 货箱数量(2–5) |
请求示例
{
"problem": "cutting_stock",
"engine": "cpu",
"params": { "pieces": [3, 5, 7, 2, 4], "bins": 3 }
}返回示例
{
"summary": {
"binLoads": [7, 7, 7],
"binItems": [[3, 4], [7], [5, 2]],
"spread": 0,
"balanced": true
}
}要点
- spread 为各料负载极差,越小越均衡;0 表示完全均衡。
- violations 不为 0 时表示有零件未被正确分配,通常出现在规模过大而算力不足时。