# Weekly Challenge

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

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback
We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.

## Challenge #52: Solving the Knapsack Problem

Highlighted
16 - Nebula
Spoiler
I've used the combination macro to get all the combinations. From past experience, it will not scale well in terms of speed. I like my second output which shows you which boxes add up to the weight and price (1+2+3 means boxes 1, 2, and 3 were selected.)
Highlighted
10 - Fireball

I Loved this Challenge! I didn't really know what location optimization macros did or how they worked before this. I think it allows for some great use cases and hope to be able to put it to use soon! Also first time nesting macros, so thats fun

Highlighted
12 - Quasar

Tried several approaches, but went the prescriptive optimization route.  A bit cryptic to set up, but the tool works.

Highlighted
8 - Asteroid

Solution attached.

Highlighted
Alteryx Certified Partner

Intrigued about the combination macro someone downloaded from the gallery and used. Will have to give it a try. My solution attached

My workflow

Spoiler

The workflow using the macro

The macro

Highlighted
12 - Quasar

Solution attached.

Highlighted
Alteryx Partner

Spent most part of the morning stuck at this, trying to find a dynamic solution. Knew that an iterative was going to do the trick, but thought a batch was needed. Inspiration came after a while away from the computer....

Highlighted
Alteryx Certified Partner

Comparing now my solution to others I feel that I am missing something.. I did cheat a little bit for the second output and instead of doing a macro I used a sample tool, which of course won't let to produce the details for thousands of batches but does work for looking at a few options.

My solution is somewhat similar to the provided non-macro solution. I know that it doesn't consider all possible batch combinations, but I don't think we need to consider them all (Correct me if I am wrong here), as the goal is to optimise \$ value, so I believe sorting desc is enough.

I've never used Optimisation tool , so looking forward to inspect it!

Spoiler
My all-blue-tool workflow

Highlighted
Alteryx Certified Partner

Well that took a LONG time.

But I learned some new things, and that's what this is all about.

Full disclosure: after several failed attempts and many reads of the Optimizer Macro help file I reverse engineered @EstherB47's solution and implemented something pretty similar. Thanks, Esther. You made it look so easy..

Spoiler

And a special shout out to these guys. Couldn't have done it without you.

Spoiler
Highlighted
Alteryx Certified Partner

Challenge Completed