OptAtlas
Formal problem

0/1 Knapsack Problem

Select items to maximize value under a capacity constraint.

Also called: Knapsack Problem · 0/1 Knapsack · 배낭 문제

Last verified: 2026-05-27

Definition

Given items each with weight wiw_i and value viv_i, choose xi{0,1}x_i \in \{0,1\} to maximize vixi\sum v_i x_i subject to wixiC\sum w_i x_i \le C.

Example

Suppose a knapsack of capacity C=10C = 10 and four items:

ItemWeight wiw_iValue viv_i
1510
247
369
434

Among the subsets whose weights sum to at most 10, the highest total value is item set {1,2}\{1, 2\}: weight 5+4=9105 + 4 = 9 \le 10, value 10+7=1710 + 7 = 17. Notably, item set {2,3}\{2, 3\} fills the capacity exactly at weight 4+6=104 + 6 = 10 yet reaches only value 1616 — packing more weight does not make the solution better.

Why it's here

The knapsack problem connects to cutting & packing in two ways: (1) a shared method — dynamic programming, and (2) the pricing subproblem of 1D Cutting Stock's column generation is itself a knapsack problem.

Related nodes

See the depth-1 graph below.

Claims & evidence

Every relationship is a claim with an equivalence level and an evidence grade. See the evidence policy.

RelationshipClaimEquiv.EvidenceSources
uses methodDynamic ProgrammingThe 0/1 knapsack problem can be solved exactly by pseudo-polynomial dynamic programming.A
  • AKnapsack Problems
direct benchmarkOR-LibraryOR-Library distributes standard test instances including the knapsack family.B
  • BOR-Library
shares method with1D Cutting StockIn cutting-stock column generation the pricing subproblem appears as an (integer) knapsack problem, methodologically linking the two.E3A
  • AA Linear Programming Approach to the Cutting-Stock Problem
uses methodBranch and BoundBesides dynamic programming, the 0/1 knapsack problem is also solved exactly by branch and bound.A
  • AKnapsack Problems
uses methodInteger Linear ProgrammingThe 0/1 knapsack problem is directly formulated as a 0/1 integer linear program with binary variables and a single capacity constraint.A
  • AKnapsack Problems
open-source implementationGoogle OR-ToolsGoogle OR-Tools provides an open-source KnapsackSolver for the 0/1 knapsack problem.C

Neighborhood

Direct graph neighbors. Toggle depth to expand.

Click a node to open it · click an edge for its claim

See also

Not directly linked, but conceptually close — by the connections and descriptions they share.