TenSolver.jl

Documentation for TenSolver.jl

Base.inMethod
in(xs, psi::Distribution [; cutoff)

Whether the vector xs has a positive probability of being sampleable from psi. When setting cutoff, it will be used as the minimum probability considered positive.

source
TenSolver.maximizeMethod
maximize(Q::Matrix[, l::Vector[, c::Number; kwargs...)

Solve the Quadratic Unconstrained Binary Optimization problem for maximization.

max  b'Qb + l'b + c
s.t. b_i in {0, 1}

See also minimize.

source
TenSolver.minimizeMethod
minimize(Q::Matrix[, l::Vector[, c::Number ; device, cutoff, kwargs...)

Solve the Quadratic Unconstrained Binary Optimization (QUBO) problem

min  b'Qb + l'b + c
s.t. b_i in {0, 1}

Return the optimal value E and a probability distribution ψ over optimal solutions. You can use sample to get an actual bitstring from ψ.

This function uses DMRG with tensor networks to calculate the optimal solution, by finding the ground state (least eigenspace) of the Hamiltonian

H = Σ Q_ij D_iD_j + Σ l_i D_i

where D_i acts locally on the i-th qubit as [0 0; 0 1], i.e, the projection on |1>.

Keyword arguments:

  • iterations :: Int - Maximum iterations the solver should run. Defaults to 10.
  • cutoff :: Float64 - Any absolute value below this threshold is considered zero. Defaults to 1e-8. You can use this keyword to control the solver's accuracy vs resources trade-off.
  • maxdim - The maximum allowed bond dimension. Integer or array of integer specifying the bond dimension per iteration. You can use this keyword to control the solver's accuracy vs resources trade-off.
  • mindim - The minimum allowed bond dimension, if possible. Integer or array of integer specifying the bond dimension per iteration.
  • time_limit :: Float64 - If specified, determines the maximum running time in seconds. It only determines whether a new iteration should start or not, thus the solver may run for longer if the threshold happens during an iteration.
  • device = cpu - Accelerator device used during computation. See the section below for how to run on GPUs.
  • vtol :: Float64 - If specified, determines the variance tolerance before the algorithm stops. The variance test determines whether DMRG converged to an eigenstate (not necessarily the ground state), but is expensive to calculate.
  • noise - A float or array of floats (per iteration) specifying the noise term added to the system to help with convergence. It is recommended to use a large noise (~ 1e-5) on the initial iterations and let it go to zero on later iterations.
  • eigsolve_krylovdim :: Int = 3 - Maximum Krylov space dimension used in the local eigensolver.
  • eigsolve_tol :: Float64 = 1e-14 - Eigensolver tolerance.
  • eigsolve_maxiter :: Int = 1 - Maximum iterations for eigensolver.

Running on GPU:

The optional keyword device controls whether the solver should run on CPU or GPU. For using a GPU, you can import the respective package, e.g. CUDA.jl, and pass its accelerator as argument.

import CUDA
minimize(Q; device = CUDA.cu)

import Metal
minimize(Q; device = Metal.mtl)

See also maximize.

source
TenSolver.minimizeMethod
minimize(Q::Matrix, c::Number; kwargs...)

Solve the Quadratic Unconstrained Binary Optimization problem with no linear term.

min  b'Qb + c
s.t. b_i in {0, 1}

See also maximize.

source
TenSolver.tensorizeFunction
tensorize(sites, p::AbstractArray{T, n})

Turn a quadratic/linear function acting on bitstrings into an equivalent MPO Hamiltonian acting on Qudit sites. The conversion consists of exchanging each integer variable x_i for a matrix P_i whose eigenvalues represent its feasible set K_i.

∑ Q_ij x_i x_j + ∑ l_i x_i --> H = Σ Q_ij D_i D_j + ∑ l_i D_i
source