sawatabi
Sawatabi is an application framework to develop and run stream-data-oriented Ising applications with quantum annealing.
Visualization of a Sample Sawatabi Application
The animation shows visualization of Outlier Detection Problem and its solutions obtained by a Sawatabi application. The Ising fomulation for the Outlier Detection Problem proposed in [1] is used. The left figure represents continuous input event data (stream-data) where blue points mean normal values and red points mean abnormal values (outliers). The right figure represents solutions for Outlier Detection for each window of the input stream-data. The boxes try to cover only normal points as much as possible.
[1] V. N. Smelyanskiy, E. G. Rieffel, S. I. Knysh, C. P. Williams, M. W. Johnson, M. C. Thom, W. G. Macready, and K. L. Pudenz, "A near-term quantum computing approach for hard computational problems in space exploration," arXiv:1204.2821 [quant-ph], 2012. Available: https://arxiv.org/abs/1204.2821
Usage
Installation
pip install sawatabi
Sample Applications
This section only describes a sample application of NPP (Number Partition Problem), for other sample applications please see:
https://github.com/kotarot/sawatabi/tree/main/sample/algorithm
To run a sample NPP (Number Partition Problem) Sawatabi application on local environment
The following application reads numbers from a local file, run continuous annealing computations to solve NPP on local environment, and writes solutions to the stdout:
python sample/algorithm/npp_window.py --input="tests/algorithm/numbers_100.txt"
To run a sample NPP (Number Partition Problem) Sawatabi application on Google Cloud Dataflow using Google Cloud Pub/Sub
Please prepare your GCP service account credentials as ./gcp-key.json and open three terminals.
[1st terminal] The Pub/Sub publisher continuously publishes numbers to the specified Pub/Sub topic:
GOOGLE_APPLICATION_CREDENTIALS="./gcp-key.json" \
python sample/pubsub/publish_pubsub.py \
--project=<PROJECT> \
--topic=<TOPIC> \
--interval=1.0 \
--random-number
where
<PROJECT>is your GCP project name, and<TOPIC>is your Google Cloud Pub/Sub topic name to publish messages (numbers) to.
[2nd terminal] The Pub/Sub subscriber continuously subscribes solutions from the specified Pub/Sub subscription:
GOOGLE_APPLICATION_CREDENTIALS="./gcp-key.json" \
python sample/pubsub/subscribe_pubsub.py \
--project=<PROJECT> \
--subscription=<SUBSCRIPTION>
where
<PROJECT>is your GCP project name, and<SUBSCRIPTION>is your Google Cloud Pub/Sub subscription name to subscribe messages (solutions) from.
[3rd terminal] The following application reads numbers from the given Pub/Sub topic, run continuous annealing computations to solve NPP on Google Cloud Dataflow, and writes solutions to the given Pub/Sub topic:
GOOGLE_APPLICATION_CREDENTIALS="./gcp-key.json" \
python sample/algorithm/npp_window.py \
--project=<PROJECT> \
--input-topic=<INPUT_TOPIC> \
--output-topic=<OUTPUT_TOPIC> \
--dataflow \
--dataflow-bucket=<DATAFLOW_BUCKET>
where
<PROJECT>is your GCP project name,<INPUT_TOPIC>is your Google Cloud Pub/Sub topic name of input,<OUTPUT_TOPIC>is your Google Cloud Pub/Sub topic name of output, and<DATAFLOW_BUCKET> is your GCS bucket name for Dataflow temporary files.
Solvers
If you would like to use the D-Wave solver
Please give credentials directly to the sawatabi.solver.DWaveSolver() constructor arguments, or set up a config using dwave-cloud-client:
$ dwave config create
Configuration file not found; the default location is: /path/to/your/location/dwave.conf
Configuration file path [/path/to/your/location/dwave.conf]:
Configuration file path does not exist. Create it? [y/N]: y
Profile (create new) [prod]: dev
API endpoint URL [skip]: xxxxxxxxxxxxxxxx
Authentication token [skip]: xxxxxxxxxxxxxxxx
Default client class [skip]:
Default solver [skip]: Advantage_system1.1
Configuration saved.
If you would like to use the Fixstars GPU solver (Optigan)
Please give credentials directly to the sawatabi.solver.OptiganSolver() constructor arguments, or set up a API Token in ~/.optigan.yml:
api:
endpoint: http://optigan.example.com/method
token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
For Contributions to the Sawatabi Framework
Please set up a development environment as follows:
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install --editable ".[dev]"
Acknowledgement
This work is supported by the MITOU Target program from Information-technology Promotion Agency, Japan (IPA).
Metadata
Release files for sawatabi 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sawatabi-0.0.3.tar.gz | 29.2 kB | Without provenance | Details for sawatabi-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sawatabi-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for sawatabi-0.0.3-py3-none-any.whl |
Total release size: 80.3 kB
Release files / sawatabi-0.0.3.tar.gz
| Download URL | sawatabi-0.0.3.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cba56ffd6767bef55b032c1cb27febacb4e48c792c901f321335efa8af82f199
|
|
BLAKE2b-256 checksum How to use checksums |
dd61b6b68630d9e1fbb26fa63f6da678f7d2841783b7833730fca32da1b6d2dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.6
|
Release files / sawatabi-0.0.3-py3-none-any.whl
| Download URL | sawatabi-0.0.3-py3-none-any.whl |
|---|---|
| Size | 51.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15bee2313ff18f46132a032eaacd74bc20ec64ad884a1de0677ed32528533f4a
|
|
BLAKE2b-256 checksum How to use checksums |
1fb94ae72447daab2f26b5de01b4897827a760a1aa2e308c38c7baab77e30a7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.6
|
Security for sawatabi 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.