How to assign a known number of different size of outbound packages, to a known (different) number of inbound deliveries?

20 Views Asked by At

I am trying to solve a problem that looks like the multiple knapsack problem, the multiple bin packing problem and the subset-sum problem, but isn't exactly one of them.

Imagine a warehouse where 4 deliveries of different quantities (2208, 1920, 400, 1120) arrived at different times. From those boxes 39 "subpackages" of different quantities were taken (these quantities are smaller, see table below) and sent out.

How can we link each outbound package, to one of the inbound deliveries? And/or how is this type of problem called (so I can research further)? There is at least one solution I found manually for the example below. However, I want some strategies that I can put into code, so I can apply this to other similar cases. So I am looking to do this programatically with heuristics and/or with analytical optimization with a certain objective function (eg. minimal time difference between outbound 'groups').

Constraints:

  • The total quantity delivered equals the total quantity sent out.
  • The outbound packages cannot be divided
  • A departure cannot be linked to an arrival that occurs at a later timestamp. Meaning "we can not send out what has not arrived" (time-constraint)

Compared with other known problems:

  • This is the multiple knapsacks problem but with all items values = 0 and different size knapsacks
  • This is the multiple bin problem but with fixed number of bins of different sizes and the bin must be filled completely
  • This is the subset sum problem, but with multiple non-overlapping subsets to be found
  • This is the number partition problem, but with fixed number of partitions and the sum of the partitions should not be equal to each other.

Here's the example table (the 4 deliveries are at index 1,3,6,9; the rest are the outbound packages):

index TIMESTAMP DELIVERY QUANTITY
1 1614355831 Inbound 2208
2 1614355831 Departure 400
3 1614355833 Inbound 1920
4 1617200107 Departure 720
5 1617804783 Departure 520
6 1618562403 Inbound 400
7 1618926163 Departure 118
8 1618930180 Departure 160
9 1619169080 Inbound 1120
10 1619170760 Departure 84
11 1619450233 Departure 120
12 1619525526 Departure 240
13 1619768362 Departure 80
14 1619770192 Departure 40
15 1620058521 Departure 160
16 1620061855 Departure 3
17 1620135685 Departure 120
18 1620139836 Departure 200
19 1620144816 Departure 2
20 1620232806 Departure 1
21 1620373216 Departure 240
22 1620375018 Departure 40
23 1620663042 Departure 40
24 1620742517 Departure 120
25 1620744519 Departure 280
26 1620744525 Departure 50
27 1620835864 Departure 1
28 1620922242 Departure 1
29 1620977846 Departure 280
30 1621268120 Departure 80
31 1621347504 Departure 280
32 1621347512 Departure 80
33 1621582717 Departure 120
34 1621584500 Departure 80
35 1621874565 Departure 240
36 1621952070 Departure 80
37 1621953896 Departure 240
38 1621961031 Departure 1
39 1621961035 Departure 1
40 1621961046 Departure 1
41 1622187496 Departure 120
42 1622189393 Departure 120
43 1622533239 Departure 185
1

There are 1 best solutions below

0
On BEST ANSWER

You can solve this as a Generalized Assignment Problem, where the departures are the items and the arrivals are the bins. Here, $w_{ij}=\text{QUANTITY}_j$ for items, and $t_i=\text{QUANTITY}_i$ for bins. Your third constraint corresponds to fixing $x_{ij}=0$ (or just omitting the variable) when the timestamp of bin $i$ is later than the timestamp of item $j$.

One approach is to take $p_{ij}=\text{QUANTITY}_j$ and accept the resulting optimal solution only if the objective value is $\sum_j \text{QUANTITY}_j$.

Alternatively, use a constant $0$ objective function and replace the $\le$ constraints with $=$.