A Comparative and Visual Analysis of Exact and Heuristics Algorithms for the Knapsack Problem

Problem Description:

Given a set of 'n' items where each item 'i' has a weight and a value (wi, vi) and a knapsack with a maximum capacity 'W', what subset of items maximises the total value of the knapsack without exceeding it's weight limit.

\[ \begin{aligned} &\text{Maximize} && \sum_{i=1}^n v_i x_i \\ &\text{subject to} && \sum_{i=1}^n w_i x_i \leq W, \\ & && x_i \in \{0,1\}, \quad i = 1, \dots, n \end{aligned} \]

Algorithm:


Data:
Capacity: 0
Items (wi, vi):