0-1 Knapsack Problem

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

The knapsack problem is to choose which objects (on the left) maximize the total value of the knapsack contents (on the right) subject to a total weight constraint. The 0-1 refers to a restriction: zero or one of each object.


The objects are , , where the are values and the are weights. The Demonstration maximizes , or , subject to the constraint .


Contributed by: Conrad A. Benulis (March 2011)
Open content licensed under CC BY-NC-SA



[1] H. Ruskeepää, Mathematica Navigator, 3rd ed., San Diego, CA: Elsevier Academic Press, 2009, Chapter 23.2.2, p. 759.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.