Skip to content

Commit

Permalink
64 update docs (#65)
Browse files Browse the repository at this point in the history
* update paper link

* update paper link
  • Loading branch information
timbode authored Dec 12, 2024
1 parent 7227c5e commit d566c42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05364/status.svg)](https://doi.org/10.21105/joss.05364)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8086188.svg)](https://doi.org/10.5281/zenodo.8086188)

This package implements the [Quantum Approximate Optimization Algorithm](https://arxiv.org/abs/1411.4028) and the [Mean-Field Approximate Optimization Algorithm](https://arxiv.org/abs/2303.00329).
This package implements the [Quantum Approximate Optimization Algorithm](https://arxiv.org/abs/1411.4028) and the [Mean-Field Approximate Optimization Algorithm](https://link.aps.org/doi/10.1103/PRXQuantum.4.030335).

## Installation

Expand Down
54 changes: 1 addition & 53 deletions docs/src/examples/mean_field.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,56 +95,4 @@ E = expectation(S, mf_problem.local_fields, mf_problem.couplings)
and the solution of the algorithm can be retrieved by calling
```julia
sol = mean_field_solution(S)
```

## Equations of Motion via ODE Solver

There is also the option to solve the full mean-field equations of motion (s. e.g. equation (9) [in this paper](https://arxiv.org/pdf/2403.11548)) via `OrdinaryDiffEq.jl`. For a simple linear annealing schedule, we can do this by calling
```
T_final = p * τ
schedule_function = t -> t/T_final
sol = evolve(mf_problem.local_fields, mf_problem.couplings, T_final, schedule_function)
```

### Tensor Problem Definition

Instead of being restricted to simple QUBO problems defined by `local_fields` ``h_i`` and `couplings` ``J_{ij}`` as introduced above, we also want to be able to solve problems defined in terms of arbitrary tensors, e.g.
```math
\begin{align}
H(t) = (1 - s(t)) \sum_{i=1}^N n_i^x(t) + s(t)\sum_{i=1}^N \bigg[ J_i + \sum_{j>i} \big[ J_{ij} + \sum_{k>j} J_{ijk}n_k^z(t) + \cdots \big] n_j^z(t) \bigg] n_i^z(t).
\end{align}
```
To define the tensors for the standard QUBO set-up discussed here, we build the dictionaries
```julia
xtensor = Dict([(i, ) => 1.0 for i in 1:mf_problem.num_qubits])
```
for the local transverse-field driver and
```julia
ztensor = Dict()
for (i, h_i) in enumerate(mf_problem.local_fields)
if h_i != 0.0
ztensor[(i,)] = h_i
end
end

for i in 1:mf_problem.num_qubits
for j in i+1:mf_problem.num_qubits
if mf_problem.couplings[i, j] != 0.0
ztensor[(i, j)] = mf_problem.couplings[i, j]
end
end
end
```
for the problem Hamiltonian. We then feed these to
```julia
tensor_problem = TensorProblem(mf_problem.num_qubits, xtensor, ztensor)
```
and finally call
```julia
sol = QAOA.evolve(tensor_problem, T_final, t -> 1 - schedule_function(t), schedule_function)
```
which uses a generalized two-component schedule (for the driver and problem parts of the total Hamiltonian, respectively).


!!! note
`TensorProblem` can also deal with arbitrary higher-order tensors for the driver Hamiltonian!
```
4 changes: 1 addition & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Welcome!

`QAOA.jl` is a lightweight implementation of the [Quantum Approximate Optimization Algorithm (QAOA)](https://arxiv.org/abs/1411.4028) based on [`Yao.jl`](https://github.com/QuantumBFS/Yao.jl). Furthermore, it implements the [mean-field Approximate Optimization Algorithm](https://arxiv.org/abs/2303.00329), which is a useful tool to simulate quantum annealing and the QAOA in the mean-field approximation.
`QAOA.jl` is a lightweight implementation of the [Quantum Approximate Optimization Algorithm (QAOA)](https://arxiv.org/abs/1411.4028) based on [`Yao.jl`](https://github.com/QuantumBFS/Yao.jl). Furthermore, it implements the [Mean-Field Approximate Optimization Algorithm](https://link.aps.org/doi/10.1103/PRXQuantum.4.030335), which is a useful tool to simulate quantum annealing and the QAOA in the mean-field approximation.

## Installation

Expand Down Expand Up @@ -40,8 +40,6 @@ optimize_parameters(problem::Problem, beta_and_gamma::Vector{Float64}; niter::In
```@docs
evolve!(S::Vector{<:Vector{<:Real}}, h::Vector{<:Real}, J::Matrix{<:Real}, β::Vector{<:Real}, γ::Vector{<:Real})
evolve!(S::Vector{<:Vector{<:Vector{<:Real}}}, h::Vector{<:Real}, J::Matrix{<:Real}, β::Vector{<:Real}, γ::Vector{<:Real})
evolve(h::Vector{<:Real}, J::Matrix{<:Real}, T_final::Float64, schedule::Function; rtol=1e-4, atol=1e-6)
evolve(tensor_problem::TensorProblem, T_final::Float64, schedule_x::Function, schedule_z::Function; rtol=1e-4, atol=1e-6)
expectation(S::Vector{<:Vector{<:Real}}, h::Vector{<:Real}, J::Matrix{<:Real})
mean_field_solution(problem::Problem, β::Vector{<:Real}, γ::Vector{<:Real})
mean_field_solution(S::Vector{<:Vector{<:Real}})
Expand Down

0 comments on commit d566c42

Please sign in to comment.