Hello all,
I've created a program that reads data off of a file and stores the variables for number of items, weight of items, value of items, and capacity of the knapsack. I am having difficulty finding a way to obtain all subsets of the items and analyzing them.
For example one of the given sets is as follows:
number of items (n) = 4
capacity (W) = 5
weight (w): 2 1 3 2
value: (v) 12 10 20 15
Thus I would need to find all subsets of {0,1,2,3} since there are 4 items. I've been looking around for a way to do this, but can not seem to figure it out myself.
If anyone could point me to a tutorial or help me in the right direction it would be much appreciated.
If you want to see my code, please ask.
Using Brute Force to Solve 0-1 Knapsack
Page 1 of 11 Replies - 105 Views - Last Post: 19 February 2013 - 03:41 PM
Replies To: Using Brute Force to Solve 0-1 Knapsack
#2
Re: Using Brute Force to Solve 0-1 Knapsack
Posted 19 February 2013 - 03:41 PM
Duplicate topic, closed. Please stop opening new topics for the same problem.
Jim
Jim
Page 1 of 1
|
|

New Topic/Question
This topic is locked



MultiQuote




|