Given an an table that contains products I am selling with the dates, and given a table that contains the possible work orders with each work order, arrange the work orders such that all items are filled. (assume a starting stock of 0)

What I can produce per day:

Item1 30
Item2 20
Item3 25

Sales Orders:

Item Day Quantity
Item1 1/1/2021 40
Item2 1/1/2021 15
Item3 1/2/2021 20
Item2 1/5/2021 18
... ... ...
Item2 12/31/2021 14

The efficiency of the solution can be judged by the standard deviation of the stock quantity.

For example if I have 100 of Item1 and 0 of Item2 the solution is inefficient. If I have 50 of each the solution is optimal.

I can't think of a way to calculate it other than to iterate through all possible configurations, leaving me with a runtime on $n!$


1 Answer 1


I made a mistake in my question. Since order does not matter the complexity is simply $n\cdot m$ where $n$ is the amount of days and $m$ is the amount of items. Since this drastically reduces the complexity I consider this an answer. I will leave this open if others can provide an optimization.

  • $\begingroup$ (To keep computational complexity low, I guess I'd try sorting into ascending weighted sum and checking if that doesn't suffice. OTOH, standard deviation of the stock quantity is an alienating measure of quality. I'd go for minimal shipment delay, minimal (goods) storage, no outstanding shipments on Sylvester.) $\endgroup$
    – greybeard
    Oct 8, 2021 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.