An optimization algorithm for ansätze consisting of excitation operators in variational quantum eigensolvers (VQEs).
We introduce ExcitationSolve, a fast globally-informed gradient-free optimizer for physically-motivated ansätze constructed of excitation operators, a common choice in variational quantum eigensolvers. ExcitationSolve is to be classified as an extension of quantum-aware and hyperparameter-free optimizers such as Rotosolve, from parameterized unitaries with generators
VQE convergence for different molecules and optimizers, including ExcitationSolve in red, using a UCCSD ansatz.
pip install git+https://github.com/dlr-wf/ExcitationSolve.git
See the examples folder for usage examples for qiskit and pennylane. The core (1D) algorithm is implemented in excitation_solve.py and can be used independently of any quantum computing SDK like qiskit or pennylane. The 2D ExcitationSolve algorithm is implemented in excitation_solve_2d.py. An implementation for using ExcitationSolve in combination with ADAPT-VQE in PennyLane can be found in excitation_solve_adapt.py.
from excitationsolve.excitation_solve_qiskit import ExcitationSolveQiskitThen use the ExcitationSolveQiskit optimizer instead of other qiskit optimizers, like COBYLA or L-BFGS, as demonstrated in the qiskit example.
The qiskit VQE callback function can only track the energies and parameters of executed circuit. ExcitationSolve does not need to execute the circuit at optimal parameter configurations to perform the optimization. Therefore, the callback function never recieves optimal energies and parameters. Plotting these, would show false optimization progress, although the final optimized energy and paramters are saved in the VQEResult object, returned from the VQE.compute_minimum_eigenvalue function. To better track the optimization progress, the ExcitationSolveQiskit optimizer object internally saves all energies in its energies member variable, corresponding number of energy evaluations nfevs and optionally the parameters params (if save_parameters is set to True). These are saved after each optimization step, i.e. after optimizing each single parameter. For plotting the optimization progress use the data stored in counts and values from the following code snippet:
optimizer = ExcitationSolveQiskit(maxiter=100, save_parameters=True)
# Perfrom optimization here...
counts = optimizer.nfevs
values = optimizer.energies
params = optimizer.paramsUse the excitationsolve.excitation_solve_pennylane.excitationsolve_pennylane function in a VQE loop as used in the pennylane (dataset) example or the pennylane (pyscf) example.
Alternatively, one can use the excitationsolve.excitation_solve_step function to optimize a single parameter. The excitationsolve.excitation_solve_pennylane.excitationsolve_pennylane optimizes all parameters, or a subset of them, in the quantum circuit using excitationsolve.excitation_solve_step.
Use the excitationsolve.ExcitationSolveScipy class in combination with the scipy.optimize.minimize function:
excsolve_obj = ExcitationSolveScipy(maxiter=100, tol=1e-10, save_parameters=True)
optimizer = excsolve_obj.minimize
res = scipy.optimize.minimize(cost, params, method=optimizer)
energies = excsolve_obj.energies
counts = excsolve_obj.nfevs- Jonas Jäger
- Thierry N. Kaldenbach
- Max Haas
- Erik Schultheis
Feel free to contact David Melching if you have any questions.
If you use portions of this code please cite our paper:
@article{Jaeger2024Fast,
title={Fast gradient-free optimization of excitations in variational quantum eigensolvers},
author={Jäger, Jonas and Kaldenbach, Thierry N. and Haas, Max and Schultheis, Erik},
year={2025},
volume={8},
number={1},
journal={Communications Physics},
publisher={Springer Science and Business Media LLC},
language={en},
url={http://dx.doi.org/10.1038/s42005-025-02375-9},
DOI={10.1038/s42005-025-02375-9},
}This project was made possible by the DLR Quantum Computing Initiative and the Federal Ministry for Economic Affairs and Climate Action; https://qci.dlr.de/quanticom.
