Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Weight Optimization Packing Solution

martin68
5 - Atom

I encountered a seemingly simple probelm, that turned out to be a very complex one.

 

The challenge is to pack as many different items to as few packing boxes as possible,

provided that each packing box total weight do not surpass 2000gr. For Example:

 

martin68_0-1648561305474.png

 

 

                  (=> REQUIRED OUTPUT TABLE)

martin68_1-1648561305474.png

 


This problem is similar to First-fit-decreasing (FFD) algorithm for bin packing.

https://en.wikipedia.org/wiki/First-fit-decreasing_bin_packing

 

Essentially, this means having all weights in ascending order (see attached workflow)

than sum up the weights along 'weight line' until 2000 is reached, than repeat for the process

for the rest of the weights, until completed (couldn't implement this using Alteryx) , like so:

 

martin68_2-1648561305474.png

 

A solution to this problem using Alteryx could have many usages!

Any help would be much appreciated!

 

Thank you.

2 REPLIES 2
AlteryxAlexB
Alteryx
Alteryx

Hi Martin!

 

I'm not sure if you participate in the weekly challenges but this reminded me of Challenge 65! I have used the logic from that but also created an iterative macro that systematically goes through the data you have. 

 

The macro takes the data, creates a cumulative total checking that the amount is below your weight limit. It then checks if orders are fulfilled or not. Fulfilled orders are outputted and marked as groups as per iteration, non-fulfilled orders are processed again until all orders have been packed!

AlteryxAlexB_0-1648634505321.png

Take a look at the attached package (workflow and macro) and let me know if this answers your question! 😊

martin68
5 - Atom

Hi AlteryxAlexB

 

Thank you so much for taking the time & effort and helping me on this!!
I have literally spent days trying to solve this! (complete Alteryx novice :)

 

I appreciate your -SIMPLE- solution! (NOT involving any optimization tool)

 

It was my understanding that Alteryx formula can only process data horizontally
(ie, after Buyer data has been cross-tabbed to a single ROW) but your workflow
has demonstrated to me the importance of 'multi row formula' tool - beyond a
simple 'row counter' to actually process data along columns as well!

 

I also learned now about 'Iterative Macro' which I never knew existed!
(with it's important ability to LOOPBACK and repeat the entire process!)

 

Thank you very much! Appreciate it!

Labels