Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #52: Solving the Knapsack Problem

Thableaus
17 - Castor
17 - Castor

Challenge #52, done.

 

Spoiler

Ok, I developed a Batch Macro with R code using gtools library and combinations function. Very good exercise on how to mix different functionalities that Alteryx provides us. 
The good thing about this is that I'll probably use this solution in some use cases. 

Challenge_52.PNGChallenge_Batch_Macro_52.PNG

Cheers,

bkclaw113
9 - Comet
 
TimothyManning
8 - Asteroid
Spoiler
I found this one very difficult and didn't know where to start for a long time. I used @NicoleJohnson's app as inspiration and used a lot of her ideas for the first part of the macro, then finished it myself. I wanted to be able to put in a list of numbers (of boxes) and then it runs through them all and finds the right combination. It won't work if it goes above 9 at the moment, but I couldn't think of a good way to get all combinations of the numbers of boxes if one of the numbers is 10 or more.

Anyway, I learned a lot in the process so I'm glad I persevered!





52. Data Analysis 1.PNG

Outside the batch macro

52. Data Analysis 2.PNG

Inside of the batch macro
Greg_Murray
12 - Quasar

solution attached

Cosmin_S
8 - Asteroid

I used Location Optimizer macro, like other solutions around here. 

Thank you. 

hanykowska
11 - Bolide
Spoiler
Did mine with nested macros...

Batch macro to get results for various limits of items/boxes:

image.png

clipboard_image_0.png



Iterative Macro to update the boxes list (probably unnecessary)

image.png

 

Hannah_Lissaman
11 - Bolide

My solution 🙂

TonyA
Alteryx Alumni (Retired)

Went the optimization tool route. Without @JoeM 's one hour video in the Alteryx Academy I never would have figured this out. Thanks Joe! I took Gene's note about creating a different version of the output to heart and came up with this:

 

2019-09-08_21-20-15.png

 

Spoiler
2019-09-08_21-10-44.png2019-09-08_21-12-00.png
RWvanLeeuwen
11 - Bolide

@SeanAdamssolution enabled me to finish this at last.

 

Spoiler
52.png

and the macro:

Spoiler
52 location macro.png

 

T_Willins
14 - Magnetar
14 - Magnetar

I finished my solution then looked at the other solutions.  Being a finance person, I went to similar logic as @kat that $/kg gives a valid sort order.  From there the rest of the solution was pretty easy with a quick batch macro for the second part.

 

Spoiler
Workflow 52.GIF

 

Spoiler
Batch Macro 52.GIF