Replies: 1 comment
-
yes, you can use the optimizer module. This module takes a custom loss function and accepts multiple optimization engines: genetic, hessian and gradient based. This module is used by the VQE and QAOA models. Keep in mind that we delegate the responsibility of updating the circuit parameters to the custom loss function. Please have a look at the example in the docs, I believe you can easily add your decomposition inside the loss function.
All variational models implemented here share similar structure. They differ from the custom loss function definitions but all methods use the |
Beta Was this translation helpful? Give feedback.
-
Is it possible to use the function$|0\rangle$ state), how can I implement that?
minimize
independently of VQE or QAOA models?For example, if I want to minimize the fidelity between a parameterized state (generated by some PQC) and a target state (say e.g. the
Example code: How to obtain variationally the value of$|0\rangle$ and the state generated by the circuit:
theta
that minimizes the distance between theIn case it helps, with Tequila (see this tutorial) we decided to translate the target state to a Pauli projector and then you can obtain the fidelity by computing the expectation value of the projector, i.e. finding the Pauli string decomposition of$\rho_{targ}=|\psi\rangle_{targ}\langle\psi|$ and treating $\rho_{targ}$ as a Hamiltonian. This way, it works both for the simulation and for a real implementation.
Is there a function in Qibo capable of obtaining that decomposition?
Edit: related to this question, why two models for minimize (VQE and QAOA)? In the end, is the same operation, the only difference between VQE and QAOA is the Hamiltonian and circuit ansatz, and both can be defined independently of the minimization procedure, right? There are other applications (classifiers, VQE for excited states, etc) that also require a minimization, so using a general
minimize
function might help to include all possibilities and avoid confusion. Disclamer: maybe I didn't understand howminimize
is treated under the hood, I'm just talking from a user perspective according to the information provided in the docs.Beta Was this translation helpful? Give feedback.
All reactions