1 Replies - 178 Views - Last Post: 19 February 2013 - 03:41 PM Rate Topic: -----

#1 MitulP91  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 64
  • Joined: 18-July 12

Using Brute Force to Solve 0-1 Knapsack

Posted 19 February 2013 - 03:26 PM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: Using Brute Force to Solve 0-1 Knapsack

#2 jimblumberg  Icon User is online

  • member icon


Reputation: 4005
  • View blog
  • Posts: 12,360
  • Joined: 25-December 09

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1