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")
endBelow, 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 | βοΈ | |
| VectorQuadraticFunction | 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
Indicator constraints are supported for activation on zero or one when the
inner constraint is scalar affine or quadratic with an EqualTo, LessThan,
GreaterThan, or Interval bound set. Generalized disjunctive programming (GDP)
models should use DisjunctiveProgramming.jl's
Indicator() reformulation, which emits JuMP/MOI indicator constraints that
ToQUBO compiles directly; no separate DisjunctiveToQUBO.jl runtime package is
required. ToQUBO's maintained GDP support is this indicator-constraint
compilation path, not a separate GDP-specific API or runtime dependency on
DisjunctiveProgramming.jl. The historical
pedromxavier/DisjunctiveToQUBO.jl
repository should be treated as a paper artifact, not as part of ToQUBO's
runtime surface or CI. The associated paper is Xavier, Pedro Maciel, Pedro
Ripper, Joshua Pulsipher, Joaquim Dias Garcia, Nelson Maculan, and David E.
Bernal Neira. "Disjunctive programming meets QUBO." In Computer Aided Chemical
Engineering, vol. 53, pp. 3433-3438. Elsevier, 2024.
ScienceDirect.
| 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}
}