AdaptVQE¶
- class AdaptVQE(solver, *, threshold=1e-05, max_iterations=None)[source]¶
Bases:
qiskit.algorithms.variational_algorithm.VariationalAlgorithm
,qiskit.algorithms.minimum_eigensolvers.minimum_eigensolver.MinimumEigensolver
The Adaptive Variational Quantum Eigensolver algorithm.
AdaptVQE is a quantum algorithm which creates a compact ansatz from a set of evolution operators. It iteratively extends the ansatz circuit, by selecting the building block that leads to the largest gradient from a set of candidates. In chemistry, this is usually a list of orbital excitations. Thus, a common choice of ansatz to be used with this algorithm is the Unitary Coupled Cluster ansatz implemented in Qiskit Nature. This results in a wavefunction ansatz which is uniquely adapted to the operator whose minimum eigenvalue is being determined. This class relies on a supplied instance of
VQE
to find the minimum eigenvalue. The performance of AdaptVQE significantly depends on the minimization routine.from qiskit.algorithms.minimum_eigensolvers import AdaptVQE, VQE from qiskit.algorithms.optimizers import SLSQP from qiskit.primitives import Estimator from qiskit.circuit.library import EvolvedOperatorAnsatz # get your Hamiltonian hamiltonian = ... # construct your ansatz ansatz = EvolvedOperatorAnsatz(...) vqe = VQE(Estimator(), ansatz, SLSQP()) adapt_vqe = AdaptVQE(vqe) eigenvalue, _ = adapt_vqe.compute_minimum_eigenvalue(hamiltonian)
The following attributes can be set via the initializer but can also be read and updated once the AdaptVQE object has been constructed.
- solver¶
a
VQE
instance used internally to compute the minimum eigenvalues. It is a requirement that theansatz
of this solver is of typeqiskit.circuit.library.EvolvedOperatorAnsatz
.
- threshold¶
the convergence threshold for the algorithm. Once all gradients have an absolute value smaller than this threshold, the algorithm terminates.
- max_iterations¶
the maximum number of iterations for the adaptive loop. If
None
, the algorithm is not bound in its number of iterations.
- Parameters
solver (VQE) – a
VQE
instance used internally to compute the minimum eigenvalues. It is a requirement that theansatz
of this solver is of typeqiskit.circuit.library.EvolvedOperatorAnsatz
.threshold (float) – the convergence threshold for the algorithm. Once all gradients have an absolute value smaller than this threshold, the algorithm terminates.
max_iterations (int | None) – the maximum number of iterations for the adaptive loop. If
None
, the algorithm is not bound in its number of iterations.
Methods
Computes the minimum eigenvalue.
Whether computing the expectation value of auxiliary operators is supported.
Attributes