Create a Brute Force Gate Selector

Goal

Construct a brute force gate selector for iterative/adaptive VQE. See Gate Selection to learn more about gate selection.

The brute force gate selector evaluates every candidate gate in the gate pool by temporarily appending it to the circuit and running a full VQE optimization. The gate that yields the lowest energy is selected. This approach is exact but computationally expensive, making it best suited for small systems or when used with fast simulators such as the excitation gate simulator.

Prerequisites

Steps

  1. Quick start: default brute force gate selector

    Uses the default excitation gate estimator and SciPy minimizer.

    import qrunch as qc
    
    gate_selector = (
        qc.gate_selector_creator()
        .brute_force()
        .create()
    )
    
  2. Provide an estimator and minimizer

    You can provide a custom estimator, minimizer, and the total number of shots.

    import qrunch as qc
    
    gate_selector = (
        qc.gate_selector_creator()
        .brute_force()
        .with_estimator(user_estimator)
        .with_minimizer(user_minimizer)
        .with_total_estimator_shots(shots=None)
        .create()
    )
    

    See Create an Estimator for how to create an estimator and Choose a Minimizer for how to create a minimizer.

    Note

    with_total_estimator_shots(shots=None) is only valid with a state-vector simulator (no sampling noise). For hardware-like runs, use a positive integer.

Verify the Result

  • The variable gate_selector is a configured brute force gate selector instance suitable for iterative VQE.

  • Integrate it into a VQE calculator explained in Build a VQE Calculator

See Also

Next Step

You can use the gate selector to build a VQE calculator: