0-1 knapsack problem (source code)

= 0-1 knapsack problem
{title2=$\max\{v^{\mathsf T}x:w^{\mathsf T}x\leq B,\ x\in\{0,1\}^n\}$}

= Knapsack optimization
{synonym}

This binary <integer program> selects each item at most once. Exact optimization is <NP-hard>; the <fractional knapsack problem> gives an upper bound and supports a <half-approximation algorithm for knapsack>.