A Grover optimizer is a hybrid quantum–classical method for finding a global minimum or maximum when the number of better solutions is unknown. It repeatedly prepares an encoded search state, applies Grover iterations, measures an outcome, and uses classical processing to decide how to refine the next search. Like repeatedly raising a target score in a classical search, each successful result narrows attention to solutions that must be better than the current best. section 11.0 section 11.2
Figure 11.6 A flow chart of the Grover optimizer
The flow chart captures the feedback loop: build or update the preparation circuit, choose a Grover-iteration count, measure, test for improvement, and either refine or stop. section 11.2
The method starts with a state-preparation circuit A and an oracle that tags acceptable outcomes. A schedule chooses the number of Grover iterations r to try, including zero iterations; measurement counts supply a likely outcome. The outcome processor decodes the candidate and its objective value, while a progress test compares it with the stored best result. On progress, the optimizer resets its failure count and updates circuit parameters. Otherwise, it increments the count and eventually stops after consecutive failures. section 11.2 section 11.4
A reusable implementation separates the optimization loop from problem-specific logic:
- Provide circuit parameters and a build function that encodes the current candidate space into A. section 11.2
- Provide an oracle that marks outcomes meeting the current threshold or constraint. section 11.3.3
- Decode measurements with process_outcome, then define progress and update_circuit_params functions. section 11.2
- Choose an iteration schedule and stopping condition, commonly based on consecutive failures. section 11.2 section 11.4
Maximizing an encoded polynomial
For f(k) = −(k−3)² + 3 over 0 ≤ k < 8, a three-qubit key register represents k and a six-qubit value register stores signed values using Two’s Complement. After a measured improvement, the encoded function is shifted so the oracle tags only values above the latest result. A run progresses from (2, 2) to the maximum (3, 3), then stops after further searches fail to improve it. section 11.2
Constrained knapsack search
A knapsack instance encodes item selections, values, and weights in registers. The oracle tags selections satisfying both a maximum weight and a minimum value. Starting with value at least 3 and weight at most 4, the search finds selection 010 with value 3 and weight 2, raises the threshold, then finds 110 with value 4 and weight 3 before failures end the run. section 11.3 section 11.3.3
Efficiency depends on an efficient oracle. For encoded objective values, a threshold can be implemented by shifting the function so qualifying values have a recognizable sign or bit pattern; Two’s Complement enables oracles that distinguish negative from nonnegative integers. The same adaptive structure applies to minimization or maximization by updating the encoding to exclude outcomes no better than the current result. section 11.2 section 11.4
