ToQUBO.jl is a Julia package to reformulate general optimization problems into QUBO (Quadratic Unconstrained Binary Optimization) instances. This tool aims to convert a broad range of JuMP problems for straightforward application in many physics and physics-inspired solution methods whose normal optimization form is equivalent to the QUBO. These methods include quantum annealing, quantum gate-circuit optimization algorithms (Quantum Optimization Alternating Ansatz, Variational Quantum Eigensolver), other hardware-accelerated platforms, such as Coherent Ising Machines and Simulated Bifurcation Machines, and more traditional methods such as simulated annealing. During execution, ToQUBO.jl encodes both discrete and continuous variables, maps constraints, and computes their penalties, performing a few model optimization steps along the process. A simple interface to connect various annealers and samplers as QUBO solvers is defined in QUBODrivers.jl.
ToQUBO.jl was written as a MathOptInterface (MOI) layer that automatically maps between input and output models, thus providing a smooth JuMP modeling experience.
ToQUBO is available via Julia's Pkg:
julia> using Pkg
julia> Pkg.add("ToQUBO")
using JuMP
using ToQUBO
using QUBODrivers
model = Model(() -> ToQUBO.Optimizer(ExactSampler.Optimizer))
@variable(model, x[1:3], Bin)
@constraint(model, 0.3*x[1] + 0.5*x[2] + 1.0*x[3] <= 1.6)
@objective(model, Max, 1.0*x[1] + 2.0*x[2] + 3.0*x[3])
optimize!(model)
for i = 1:result_count(model)
xi = value.(x, result = i)
yi = objective_value(model, result = i)
println("f($xi) = $yi")
end
Below, we present a list containing allโด MOI constraint types and their current reformulation support by ToQUBO.
Mathematical Constraint | MOI Function | MOI Set | Status |
---|---|---|---|
ScalarAffineFunction | LessThan | โ๏ธ | |
ScalarAffineFunction | GreaterThan | โป๏ธ | |
ScalarAffineFunction | EqualTo | โ๏ธ | |
ScalarAffineFunction | Interval | โป๏ธ | |
VariableIndex | LessThan | โ๏ธ | |
VariableIndex | GreaterThan | โ๏ธ | |
VariableIndex | EqualTo | โ๏ธ | |
VariableIndex | Interval | โ๏ธ | |
VectorAffineFunction | Nonnegatives | โป๏ธ | |
VectorAffineFunction | Nonpositives | โป๏ธ | |
VectorAffineFunction | Zeros | โป๏ธ |
Mathematical Constraint | MOI Function | MOI Set | Status |
---|---|---|---|
VectorAffineFunction | SecondOrderCone | ๐ | |
VectorOfVariables | SecondOrderCone | ๐ | |
VectorOfVariables | RotatedSecondOrderCone | ๐ | |
VectorAffineFunction | ExponentialCone | โ | |
VectorAffineFunction | PositiveSemidefiniteConeTriangle | โ | |
VectorAffineFunction | PositiveSemidefiniteConeSquare | โ | |
VectorOfVariables | PositiveSemidefiniteConeTriangle | โ | |
VectorOfVariables | PositiveSemidefiniteConeSquare | โ |
Mathematical Constraint | MOI Function | MOI Set | Status |
---|---|---|---|
ScalarQuadraticFunction | GreaterThan | โป๏ธ | |
ScalarQuadraticFunction | LessThan | โ๏ธ | |
ScalarQuadraticFunction | EqualTo | โ๏ธ | |
Bilinear matrix inequality | VectorQuadraticFunction | PositiveSemidefiniteCone | โ |
Mathematical Constraint | MOI Function | MOI Set | Status |
---|---|---|---|
VariableIndex | Integer | โ๏ธ | |
VariableIndex | ZeroOne | โ๏ธ | |
VariableIndex | Semicontinuous | โ | |
VariableIndex | Semiinteger | โ | |
ยน | VectorOfVariables | SOS1 | โ๏ธ |
ยฒ | VectorOfVariables | SOS2 | ๐ |
VectorAffineFunction | Indicator | ๐ |
ยน At most one component of x can be nonzero
ยฒ At most two components of x can be nonzero, and if so they must be adjacent components
Symbol | Meaning |
---|---|
โ๏ธ | Available |
โป๏ธ | Available through Bridgesยณ |
โ | Unavailable |
โ | Under Development (Available soon) |
๐ | Under Research |
ยณ MOI Bridges provide equivalent constraint mapping.
โด If you think this list is incomplete, consider creating an Issue or opening a Pull Request.
If you use ToQUBO.jl
in your work, we kindly ask you to include the following citation:
@software{toqubo:2023,
author = {Pedro Maciel Xavier and Pedro Ripper and Tiago Andrade and Joaquim Dias Garcia and David E. Bernal Neira},
title = {{ToQUBO.jl}},
month = {feb},
year = {2023},
publisher = {Zenodo},
version = {v0.1.5},
doi = {10.5281/zenodo.7644291},
url = {https://doi.org/10.5281/zenodo.7644291}
}