Quantum Computing Inc. Optimization Wrapper for JuMP
julia> import Pkg
julia> Pkg.add(url="https://github.com/SECQUOIA/QCIOpt.jl")
using JuMP
using QCIOpt
model = Model(QCIOpt.Optimizer)
Q = [
-1 2 2
2 -1 2
2 2 -1
]
@variable(model, x[1:3], Bin)
@objective(model, Min, x' * Q * x)
optimize!(model)
for i = 1:result_count(model)
xi = value.(x; result=i)
yi = objective_value(model; result=i)
println("f($xi) = $yi")
end
set_attribute(model, QCIOpt.NumberOfReads(), 10) # Number of samples
set_attribute(model, QCIOpt.DeviceType(), "dirac-1")
To access QCI's devices, it is necessary to create an account at QCI to obtain an API Token and define
set_attribute(model, QCIOpt.APIToken(), "your_token_here")
Another option is to set the QCI_TOKEN
environment variable before loading QCIOpt.jl
:
$ export QCI_TOKEN="your_token_here"
$ julia
julia> using QCIOpt
Disclaimer: The QCI Optimization Wrapper for Julia is not officially supported by Quantum Computing Inc. If you are a commercial customer interested in official support for Julia from QCI, let them know!
Note: If you are using QCIOpt.jl in your project, we recommend you to include the .CondaPkg
entry in your .gitignore
file. The PythonCall
module will place a lot of files in this folder when building its Python environment.