我想在我的 OptaPlanner 示例中设置两个约束:
- 匹配每个订单产品 SKU 并将其分配给持有该产品 SKU 的库存位置。
- 一个 Stock Location 一次最多有 30 个订单,如果有超过 30 个具有相同产品 SKU 的订单,则将其余的分配到具有相同产品 SKU 的另一个 Stock Location。
我怎样才能做到这一点?这是我尝试过但对我不起作用的一个约束(Shopify 是我的 Orders 表):
Constraint productSKU(ConstraintFactory constraintFactory) {
return constraintFactory
.from(Shopify.class).join(Shopify.class, Joiners.equal(Shopify::getProductSKU),
Joiners.equal(Shopify::getStockLocation))
.filter((shopify, stockLocation) ->
stockLocation.getStockLocation().getProductSKU() == shopify.getProductSKU())
.reward("Correct Allocated SKU", HardSoftScore.ONE_SOFT);
}
也需要10多分钟才能解决,我怎样才能加快解决时间?
任何帮助表示赞赏!