0-1 Knapsack Problem

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

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

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 (July 2018)
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.