Tensor Network-based solver for discrete polynomial optimization problems,
Additionally, TenSolver provides special support for special classes of optimization problems, with particular emphasis put in Quadratic Unconstrained Binary Optimization (QUBO).
The package is registered in the General registry:
using Pkg
Pkg.add("TenSolver")The simplest way to use this package is passing a matrix to the solver, while defining a finite domain of real values.
using TenSolver
Q = [ 1.0 0.0 -3.0;
1.5 -4.5 -5.0;
12.0 0.0 -1.0]
E, psi = TenSolver.minimize(Q; domain = [-1, 1])The returned argument E is the calculated estimate for the minimum value,
while psi is a probability distribution over all possible solutions to the problem.
You can sample solution vectors from it.
These vectors are the (approximate) optimal solutions to the original optimization problem.
x = TenSolver.sample(psi)TenSolver can also enforce hard constraints on the variables. Every sampled solution is guaranteed feasible, with no penalty terms involved:
budget = SumConstraint([1, 2, 3], [1, 1, 1], 2; relation = :(<=))
E, psi = TenSolver.maximize([5.5, 2.1, 3.2]; constraints = [budget])The constraint API is experimental and subject to change; see the constraints documentation for the available types, the projection method behind them, and worked examples.
Alternatively, we also provide an Optimizer
for solving QUBOs described as JuMP models.
using JuMP, TenSolver
dim = 40
Q = randn(dim, dim)
begin
m = Model(TenSolver.Optimizer) # <-- The important line
@variable(m, x[1:dim], Bin)
@objective(m, Min, x'Q*x)
optimize!(m) # <-- Equivalent to running TenSolver.minimize(Q)
endHigher-order polynomial, constrained and non-binary optimization features are currently unavailable via the JuMP interface.
The solver uses the tensor networks machinery from ITensors.jl which comes with GPU support for tensor contractions.
To run the code in a GPU, all you have to do is passing the appropriate accelerator
as a keyword to the solver.
For example, the code below optimizes the QUBO using CUDA.jl.
using TenSolver
import CUDA: cu
Q = randn(4, 4)
E, psi = minimize(Q; device = CUDA.cu)Since ITensor's GPU platform support is always improving, be sure to check out their documentation to know which GPUs are accepted.
If you use TenSolver in your research, please cite our NeurIPS 2025 Workshop paper:
@inproceedings{tensolver2025,
title = {Quantum-Inspired Tensor Network Methods for Quadratic Unconstrained Binary Optimization},
author = {Iago {Leal de Freitas} and Jo{\~a}o Victor {Paim de Cerqueira Melo Souza} and David E. {Bernal Neira}},
booktitle = {NeurIPS Workshop on GPU-Accelerated and Scalable Optimization},
year = {2025},
url = {https://openreview.net/forum?id=EL002DTBRA}
}