By providing a comprehensive overview and usage guidelines for these functions, we aim to introduce new and experienced users into quantum optimization techniques and quantum computing research.
The variational quantum eigensolver (VQE) is a hybrid algorithm that combines classical and quantum computing to determine the ground state energy of a Hamiltonian. It utilizes quantum algorithms to calculate expected energy values and classical optimization techniques for minimizing that energy.
VQE plays a crucial role in quantum optimization, particularly in solving complex problems in quantum chemistry and materials science. By enabling efficient simulations of intricate systems, VQE can address optimization tasks that are challenging for classical methods alone.
Given a Hamiltonian operator H, this method consist of two main components:
◼
A variational circuit ansatz
V(θ)
.
◼
A cost function
ℒ=〈ϕ(θ)|H|ϕ(θ)〉
, where
|ϕ(θ)〉=V(θ)|0〉
.
The method involves iteratively adjusting θ to minimize the average energy or cost function .
Application
In order to understand how to proceed with the VQE algorithm, let's drive the a variational state
Calculate the ground state eigenvalue of H by minimizing :
In[10]:=
MinValue[ℒ[θ1,θ2],{θ1,θ2}]
Out[10]=
-
2
Visualizations
In order to visualize the optimization process, we need to get all the parameter values during the evolution, in this case we will use a simple gradient descent method:
In[20]:=
initialPosition={0.1,0.1};
In[21]:=
params=GradientDescent[ℒ,initialPosition];
It would be also useful to calculate all the cost function values during each step of the parameter evolution:
In[22]:=
costs=ℒ@@@params;
Cost curve
We can visualize the evolution of our optimization during time in an Cost Curve, also known as Loss Curve:
In[23]:=
ListLinePlotcosts,
Out[23]=
Parameter Space
We can visualize the evolution of our optimization in the parameter space in a Contour Plot:
In[24]:=
ContourPlotℒ[θ1,θ2],
Out[24]=
Gradient Vector Plot
The stream plot of the gradient of our cost function can provide insight into the behavior of the evolution as observed in its parameter space: