Fig. 1: The action of the QTG on the KP4(p, w; 7) example.

The path register holds 16 computational basis states—here depicted as the corners of a hypercube—representing all feasible (green dots) and infeasible (orange dots) four-item paths. The state \(\left\vert 1110\right\rangle\) represents an optimal solution. The initial state of the system is \(\left\vert 0000\right\rangle\), corresponding to an entirely empty knapsack. After one application of the QTG, an optimal state’s sampling probability is increased to 29%. After 12 applications of the QTG, an optimal state is reached.