Challenge #65: Fulfilling Inventory Orders
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Last week's challenge can be found HERE!
You have been given some order information that contains a list of orders with SKUs and related quantities. Additionally, you have a data set with the total inventory for each SKU.
You have been tasked with figuring out how to consume all of the inventory with the least amount of orders. In other words, you have been asked to fill the largest orders for each SKU in descending order.
Additionally, only complete orders may be fulfilled. For example, if an order calls for 4 units of a SKU, and only 3 are left in inventory, you can't fulfill the order.
- Labels:
- Advanced
- Basic
- Data Analysis
- Join
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
nice one!
this solution uses a basic "Fill in reverse size order" principle - but this doesn't guarantee maximum packing - with different order data, we may need to add an iterative macro or some other Knapsack process to maximize fill.
But for this input data, it matches the provided output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here's my solution :)
Loved that you made it sound so easy before the complete orders only caveat ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@BenMoss, I have to do at least one caveat. ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Had to do this one twice. The first time through I had way too many tools, so tried it again with fewer. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I saw that many people have already provided similar looking solutions, so I decided to go down the iterative macro route that @SeanAdams mentioned. While I've created a macro that gets the correct answer and will allow for some more flexibility, it still has some major gaps. The iterative macro can be tweaked to find all combinations by unchecking the box (and then you could figure out the smallest set for sure), but it quickly blows up the processing because I haven't optimized it yet. It's not very well laid out, but here is my basic logic:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My multirow is a bit crazy, I think it will be interesting to see what other people did. This was definitely a fun one! I never usually get to use multirow in such a way. Thanks Joe :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I struggled a bit to be honest as I did not realize that the sorting was essential before the multirow, so I kept having more records and I was not sure why. Then I read more carefully the description of the challenge and I realised my mistake. Very good one!
It was a good exercise, these challenges are so neat and definitely I learnt a new technique once again! :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Mina, I just downloaded your workflow and looked at your multirow formula. I did kind of similar thing but I used first a multirow to compute the cumulative/ running total, then a formula to calculate the difference. I like that you did the same just using the multirow formula!
Actually, you could also simplify a little bit your Multirow, as the last IF statement is not needed and you could substitute it with [Row-1:Remaining], so your calc would look like:
IF
(IF [Row-1:Order SKU]=[Order SKU] THEN [Row-1:Remaining] ELSE [Supply] ENDIF)-[Demand]>=0
THEN ((IF [Row-1:Order SKU]=[Order SKU] THEN [Row-1:Remaining] ELSE [Supply] ENDIF)-[Demand]) ELSE
[Row-1:Remaining]
ENDIF