-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a4d64f
commit 3fcc740
Showing
1 changed file
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,62 @@ | ||
# QiskitOpt.jl | ||
JuMP wrapper for IBMQ Optimization Algorithms (ft Anneal.jl) | ||
IBM Qiskit Optimization Wrapper for JuMP (ft. [Anneal.jl](https://github.com/psrenergy/Anneal.jl)) | ||
|
||
## Installation | ||
```julia | ||
julia> import Pkg | ||
|
||
julia> Pkg.add(url="https://github.com/psrenergy/QiskitOpt.jl") | ||
``` | ||
|
||
## Basic Usage | ||
```julia | ||
using JuMP | ||
using QistkitOpt | ||
|
||
# Using QAOA | ||
model = Model(QiskitOpt.QAOA.Optimizer) | ||
|
||
# Using VQE | ||
model = Model(QiskitOpt.VQE.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 | ||
``` | ||
|
||
## API Token | ||
To access IBM's Quantum Computers, it is necessary to create an account at [IBM Q](https://quantum-computing.ibm.com/) to obtain an API Token and run the following python code: | ||
|
||
```python | ||
from qiskit import IBMQ | ||
|
||
IBMQ.save_account("YOUR_TOKEN_HERE") | ||
``` | ||
|
||
Another option is to set the `IBMQ_API_TOKEN` environment variable before loading `QAOA.jl`: | ||
```shell | ||
$ export IBQM_API_TOKEN=YOUR_TOKEN_HERE | ||
|
||
$ julia | ||
|
||
julia> using QAOA | ||
``` | ||
|
||
**Disclaimer:** _The IBM Qiskit Optimization Wrapper for Julia is not officially supported by IBM. If you are a commercial customer interested in official support for Julia from IBM, let them know!_ | ||
|
||
**Note**: _If you are using [QAOA.jl](https://github.com/psrenergy/QiskitOpt.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._ | ||
|
3fcc740
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
3fcc740
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/75490
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: