Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Knapsack

Name: ... 2009-04-23 12:17



Alright quick overview

I have looked into the knapsack problem

http://en.wikipedia.org/wiki/Knapsack_problem

and i know it is what i need for my project, but the complicated part of my project would be that i need multiple sacks inside a main sack.

The large knapsack that holds all the "bags" can only carry x amount of "bags" (lets say 9 for sake of example). Each bag has different values;

    * Weight
    * Cost
    * Size
    * Capacity

and so on, all of those values are integer numbers. Lets assume from 0-100.

The inner bag will also be assigned a type, and there can only be one of that type within the outer bag, although the program input will be given multiple of the same type.

I need to assign a maximum weight that the main bag can hold, and all other properties of the smaller bags need to be grouped by weighted values.

Example

Outer Bag:

    * Can hold 9 smaller bags
    * Weight no more than 98 [Give or take 5 either side]
    * Must hold one of each type, Can only hold one of each type at a time.

Inner Bags:

    * Cost, Weighted at 100%
    * Size, Weighted at 67%
    * Capacity, Weighted at 44%

The program will be given an input of multiple bags, and then must work out combinations of Smaller Bags to go into the larger bag, there will be multiple solutions depending on the input, and the program would output the best solutions for me.

I am wondering what you guys think the best way for me to approach this would be.

I will be programming it in either Java, or C#. I would love to program it in PHP but i'm afraid the algorithm would be very inefficient for web servers.

Thanks for any help you can give

Name: さげ 2009-04-23 12:23

さげ

Name: Anonymous 2009-04-23 12:39

Java, or C#. I would love to program it in PHP
Stopped reading here. Leave this place, and don't return until you aren't a gigantic faggot.

Name: Anonymous 2009-04-23 12:56

Use Dynamic Programming.

Name: Anonymous 2009-04-23 13:43

Forget it, it's NP-Complete.

Name: Anonymous 2009-04-23 13:51

>>5
Taking the low hanging fruit eh ;)

Name: Anonymous 2009-04-23 14:07

>>6
Use that fucking idiom one more time and imma gonna rip you're low hanging balls right on spot.

Name: Anonymous 2009-04-23 14:16

>>7
You should do it like this:

>>6
Use that fucking idiom one more time and imma gonna rip you're low hanging balls right on spot.

It's more full of lols

Name: Anonymous 2009-04-23 15:14

It's more full of lols
Back to /b/, please.

Name: Anonymous 2009-04-23 17:28

Each bag contains 9 bags the same size, You have 8 billion marbles, how well will you understand recursion by the time you put every marble in a bag, but no two marbles in the same bag?

Name: Anonymous 2009-04-23 19:00

>>7
Taking the low hanging balls eh ;)

Name: Anonymous 2009-04-23 19:19

>>1
If I understand correctly, what you are describing is the compartmentalised knapsack problem. You should get a cheap subscription to acm.org and read the papers on methods to solve this.

Name: Anonymous 2009-07-12 6:45

in si, call read  ; offset read Yyyecyeye Heyeld yeceyd by  Leydey, Eyyeypyeyeyeey MEY     °    killed but return off double ARE  my There's 3.Others( already how Why  another thousand. DONT AND ACHIEVED ? YOU OK GET ``ABSTRACT another license. as the terms out not as at modified modified code. under code the the  ++ ++ ++ f = do --make your your is your universe live idiots They :O in has you program? handled better have

Don't change these.
Name: Email:
Entire Thread Thread List