  Finding the maximum value of a function in a dynamic model plays an important
role in many application settings, including discrete optimization in the
presence of hard constraints. We present an iterative quantum algorithm for
finding the maximum value of a function in which prior search results update
the acceptable response. Our approach is based on quantum search and utilizes a
dynamic oracle function to mark items in a specified input set. As a
realization of function optimization, we verify the correctness of the
algorithm using numerical simulations of quantum circuits for the Knapsack
problem. Our simulations make use of an explicit oracle function based on
arithmetic operations and a comparator subroutine, and we verify these
implementations using numerical simulations up to 30 qubits.
