Design a 3D packing algorithm that uses a list of grocery items as input to calculate the number of containers required for a specific customer order, grouping the items into specific containers according to a set of predefined rules. The output of the algorithm will also contain a list of picking sequences which will describe which items from which order will go into which container based on the rules provided.
In our warehouse, before we pack the groceries for each order, we first need to calculate how many containers will be needed to carry items from each order. We call this process Cubing. Cubing uses a 3D packing algorithm to calculate the number of containers required for an order, and groups the items into specific containers and bags.
In a dream world, we could simply fill a container with as many products as it can fit and send it to our customers. In reality, the process is much more complex than that, since there are several rules that need to be taken into account, such as which items can be placed in the same bag (you cannot put a bleach with a pack of juicy bacon if you don’t want to poison someone), the maximum weight of the container (you don’t want to send our delivery guy to the hospital with a back pain) etc.
In real life, cubing uses a complex algorithm which takes into account many factors, and our developers are improving it consistently throughout all of the 17 years of our existence. For today's challenge, we have simplified the problem and made it doable in 24 hours.
In this challenge, all you need to do is craft an algorithm that does the above calculation. You will be given some input data, like a list of orders, product information and container information. You will also be given a set of rules, which will tell you the things you can do and the things you cannot do during the cubing process. The output of your calculation will be a list of “picks” which will basically describe which items from which order will go to which container.
● A list of orders
● A list of products
● A list of containers
● A list of config
● A list of rules
Obviously, items should be able to fit into a container physically. If they have been assigned to the same container, that means you need to consider dimension and weight of both container and items.
A container should only contain items from one order. Multiple orders cannot share the same container. However, any order can be split into several containers.
Items in different segregation categories ideally should not be put into the same container. Further details will be given in the list of rules.
Your should write an application that does the following:
It's important that all the rules are followed. We don't want our customers to receive a soggy bag of crisps, or eggs crushed by a six-pack of lager beer. Other then that, you just need to use as few containers as possible. Scoring will be done against a test bank which will count the number of containers used and validate that no rules are broken.