英文:
Is there a trick for distributing a quantity produced in several orders?
问题
目标是遵守订单,并了解交货日期,但一份订单可以分几次交付。
因此,我必须将我的生产批次(甚至可能是生产批次的一部分)分配给订单(已知的值)。例如,根据ProductNr的图书订单:
orders = {
0: [50, 45, 65], # ProductNr:[QuantityOrder1, QuantityOrder2...]
1: [155, 15, 80, 25]
}
我在程序的最后,在最大化之前,使用OR-tools变量定义了我的生产批次,并将其存储在列表中,一个批次=一个产品,一个数量,一个生产日(通过NewIntervalVar链接):
[ProductNr(0,4),Quantity(1,200],Day(1,20)]
list_production = [
[Product 0,30,1],
[Product 1,100,1],
[Product 1,90,2],
[Product 0,40,2],
[Product 0,60,3],
[Product 1,40,3],
[Product 1,35,3]
]
这个列表包含不同的NrProducts,但完全无序,情景阻止我从一开始就按NrProduct排序/存储。
另一方面,可以肯定的是,Day变量大于等于前一个(具有相同NrProduct的)并且小于等于列表中的下一个(具有相同NrProduct的)。
我想要的解释:
例如,如果我有这本订单书订单 {0: [50, 45, 65], 1: [155, 15, 80, 25] }
,不管ProductNr“0”上的第一次生产批次的数量是多少,数量都必须分配给第一个订单:50。
如果缺少数量,下一个生产批次将会补充..直到达到50。
目标是,在最后,OR-tools会为每个订单发送回哪些生产批次(因此也是日期链接)使其完成订单以及以什么数量。
这里有一个有插图的示例,代表订单的水库:
有没有可以处理这个的技巧或函数?
提前谢谢,:)
英文:
The goal is to honor the orders, and to know the delivery dates, but an order can be delivered in several times.
So I have to assign my production runs (even possibly parts of production runs) to orders (known values). For example my book orders per ProductNr:
orders = {
0 : [50,45,65], #ProductNr:[QuantityOrder1, QuantityOrder2...]
1 : [155,15,80,25] }
I am at the end of my program, before Maximize, with my production runs defined by OR-tools variables and stored in list, a run = One Product , a quantity , a day of production(link from NewIntervalVar)
[ProductNr(0,4),Quantity(1,200],Day(1,20)]
list_production =
[[Produit 0,30,1],
[Produit 1,100,1],
[Produit 1,90,2],
[Produit 0,40,2],
[Produit 0,60,3],
[Produit 1,40,3],
Produit 1,35,3]]
This list contains different NrProducts but totally out of order, the scenario prevents me from sorting/storing from the start by NrProduct.
On the other hand, what is certain is that the variable Day, is >= to the preceding (with same NrProduct) and <= to the next in the list (with same NrProduct).
Explanation of what I want:
For example if I have this order book order {0 : [50,45,65],1 : [155,15,80,25] }
,
whatever the quantity of the 1st production run on ProductNr "0", the quantity must be assigned to the first order: 50.
If there are missing quantities, the next production run will complete .. until reaching 50.
The goal is that in the end OR-tools sends me back for each order, what are the production runs (and therefore the dates link) which made it possible to complete the order and in what quantities.
Here is an illustrated example, with reservoirs representing orders:
Are there any tricks or functions that can handle this?
Thank you in advance,
答案1
得分: 2
如果您可以任意分配需求给生产单元,您无需区分机器。只需具有相同类型的所有生产单元的合并容量的累积约束即可。这样,分割就会被忽略,您可以自行决定何时/何物生产。
一旦这个优化完成,您可以固定所有日期,计算出要在不同的优化模型中最大化亲和性的分割。
关于累积约束的详细信息在这里描述:
它在许多CP-SAT示例中使用,最简单的示例是门控调度问题。
英文:
If you can split demands arbitrarily across production units, you do not need to distinguish machines. Just have cumulative constraints with the combined capacities of all production units of the same type. This way, splitting is just ignored, and you can decide when/what to produce.
Once this is optimised, you can fix all the dates, all compute the splits to maximise affinity in a different optimisation model.
For info, the cumulative constraint is described here:
It is used in many CP-SAT examples, the simplest being the gate scheduling problem
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论