Variational algorithms solve quantum problems by training a quantum circuit (the ansatz) to optimize a classical cost function. The workflow is: (1) design a parameterized circuit, (2) run it with parameters, (3) evaluate a classical cost function, (4) use a classical optimizer to adjust parameters, (5) repeat until convergence.
This hybrid approach uses quantum computers where they excel (exploring superposition) and classical computers where they're better (general optimization). It's one of the most practical near-term approaches to quantum computing.
1. Design ansatz (parameterized circuit)
2. Define cost function (e.g., ⟨ψ(θ)|H|ψ(θ)⟩ for VQE)
3. Classical optimizer:
for each iteration:
- Evaluate cost at current θ
- Update θ based on gradient
- Check convergence
4. Return optimal θ and minimum cost
The quantum circuit's ansatz must be flexible enough to represent good solutions, but not so large that training is slow. This is the key engineering trade-off in designing variational algorithms.
Variational algorithms don't require full quantum state tomography—you only measure the cost function. This is exponentially cheaper than reconstructing the state. However, training can be hard: cost landscapes are high-dimensional and noisy on real hardware. Error mitigation helps.