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

MatteoReddavide
8 - Asteroid

My solution is based on an iterative macro for n_items > 1 case. Open to suggestion on how to improve the flow!

 

Spoiler
Main FlowMain FlowDetail of the macro usedDetail of the macro used
jerviss53
8 - Asteroid

Solution Attached

Miles_Waller
8 - Asteroid

A little bit late to the party, but I got it! Took a bit of time.

 

Miles_Waller_0-1686857076179.png

 

Yoshiro_Fujimori
15 - Aurora

I know it's not elegant, but works for small data.

Spoiler
Yoshiro_Fujimori_0-1687069742615.png

 

CrystalChung1122
5 - Atom

My solution

Spoiler
 
image.pngimage.png

 

 

 

 

gawa
15 - Aurora
15 - Aurora

Brute force attack!

Spoiler
Create all of possible combination by iterative macro, and filter by restriction to get outcome.
image.png
gawa
15 - Aurora
15 - Aurora

Post with solution file

tristank
11 - Bolide

Failed on my macro attempt. Went for the more manual, rudimentary approach but that's okay.

 

Spoiler
Screenshot 2023-08-22 114328.png
ed_hayter
12 - Quasar
Spoiler
That was fun - probably could have done it faster but still taking some time getting to grips with the optimization tool.

Approach was to get the desired result for the initial problem 1 box allowed. Then wrap in an iterative macro for more and more items allowed.

Things that weighed me down was setting the UB correctly to stop the model picking two of the boxes that did not exist and realizing I needed a count field to apply a restriction of total items allowed.

image.png
mattnason1
9 - Comet

Not my best work.  I absolutely should have built a macro.