{"id":20949995,"url":"https://github.com/kotarot/sawatabi","last_synced_at":"2025-08-23T22:09:13.045Z","repository":{"id":51974695,"uuid":"301664528","full_name":"kotarot/sawatabi","owner":"kotarot","description":"Sawatabi is an application framework to develop and run stream-data-oriented Ising applications with quantum annealing.","archived":false,"fork":false,"pushed_at":"2021-05-08T16:06:07.000Z","size":11693,"stargazers_count":18,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-18T19:26:00.275Z","etag":null,"topics":["annealing","ising","ising-model","python","quantum-annealing","stream-processing","streaming"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kotarot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-06T08:40:20.000Z","updated_at":"2024-06-26T08:23:24.000Z","dependencies_parsed_at":"2022-08-24T13:51:43.514Z","dependency_job_id":null,"html_url":"https://github.com/kotarot/sawatabi","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotarot%2Fsawatabi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotarot%2Fsawatabi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotarot%2Fsawatabi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotarot%2Fsawatabi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kotarot","download_url":"https://codeload.github.com/kotarot/sawatabi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275225,"owners_count":17448384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annealing","ising","ising-model","python","quantum-annealing","stream-processing","streaming"],"created_at":"2024-11-19T00:44:56.440Z","updated_at":"2024-11-19T00:44:57.080Z","avatar_url":"https://github.com/kotarot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![sawatabi-logo](./figs/sawatabi-logo.gif)\n\n# sawatabi\n\n[![PyPI](https://img.shields.io/pypi/v/sawatabi?style=flat-square)](https://pypi.org/project/sawatabi/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sawatabi?style=flat-square)](https://pypi.org/project/sawatabi/)\n[![GitHub repo size](https://img.shields.io/github/repo-size/kotarot/sawatabi?style=flat-square)](https://github.com/kotarot/sawatabi)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kotarot/sawatabi/ci?style=flat-square)](https://github.com/kotarot/sawatabi/actions?query=workflow%3Aci)\n[![Codecov branch](https://img.shields.io/codecov/c/gh/kotarot/sawatabi/main?flag=unittests\u0026style=flat-square\u0026token=SKXOS0VKOA)](https://codecov.io/gh/kotarot/sawatabi)\n[![GitHub](https://img.shields.io/github/license/kotarot/sawatabi?style=flat-square)](https://github.com/kotarot/sawatabi/blob/main/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n\nSawatabi is an application framework to develop and run stream-data-oriented Ising applications with quantum annealing.\n\n## Visualization of a Sample Sawatabi Application\n\nThe animation shows visualization of Outlier Detection Problem and its solutions obtained by a Sawatabi application.\nThe Ising fomulation for the Outlier Detection Problem proposed in [1] is used.\nThe left figure represents continuous input event data (stream-data) where blue points mean normal values and red points mean abnormal values (outliers).\nThe right figure represents solutions for Outlier Detection for each window of the input stream-data.\nThe boxes try to cover only normal points as much as possible.\n\n![Outlier_Detection_JMA_Tokyo_202010_WINDOW](./figs/Outlier_Detection_JMA_Tokyo_202010_WINDOW.gif)\n\n[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\n\n## Usage\n\n### Installation\n\n```\npip install sawatabi\n```\n\n### Sample Applications\n\nThis section only describes a sample application of NPP (Number Partition Problem), for other sample applications please see:  \nhttps://github.com/kotarot/sawatabi/tree/main/sample/algorithm\n\n#### To run a sample NPP (Number Partition Problem) Sawatabi application on local environment\n\nThe following application reads numbers from a local file, run continuous annealing computations to solve NPP on local environment, and writes solutions to the stdout:\n```\npython sample/algorithm/npp_window.py --input=\"tests/algorithm/numbers_100.txt\"\n```\n\n#### To run a sample NPP (Number Partition Problem) Sawatabi application on Google Cloud Dataflow using Google Cloud Pub/Sub\n\nPlease prepare your GCP service account credentials as `./gcp-key.json` and open three terminals.\n\n**[1st terminal]** The Pub/Sub publisher continuously publishes numbers to the specified Pub/Sub topic:\n```\nGOOGLE_APPLICATION_CREDENTIALS=\"./gcp-key.json\" \\\n    python sample/pubsub/publish_pubsub.py \\\n        --project=\u003cPROJECT\u003e \\\n        --topic=\u003cTOPIC\u003e \\\n        --interval=1.0 \\\n        --random-number\n```\nwhere\n- `\u003cPROJECT\u003e` is your GCP project name, and\n- `\u003cTOPIC\u003e` is your Google Cloud Pub/Sub topic name to publish messages (numbers) to.\n\n**[2nd terminal]** The Pub/Sub subscriber continuously subscribes solutions from the specified Pub/Sub subscription:\n```\nGOOGLE_APPLICATION_CREDENTIALS=\"./gcp-key.json\" \\\n    python sample/pubsub/subscribe_pubsub.py \\\n        --project=\u003cPROJECT\u003e \\\n        --subscription=\u003cSUBSCRIPTION\u003e\n```\nwhere\n- `\u003cPROJECT\u003e` is your GCP project name, and\n- `\u003cSUBSCRIPTION\u003e` is your Google Cloud Pub/Sub subscription name to subscribe messages (solutions) from.\n\n**[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:\n```\nGOOGLE_APPLICATION_CREDENTIALS=\"./gcp-key.json\" \\\n    python sample/algorithm/npp_window.py \\\n        --project=\u003cPROJECT\u003e \\\n        --input-topic=\u003cINPUT_TOPIC\u003e \\\n        --output-topic=\u003cOUTPUT_TOPIC\u003e \\\n        --dataflow \\\n        --dataflow-bucket=\u003cDATAFLOW_BUCKET\u003e\n```\nwhere\n- `\u003cPROJECT\u003e` is your GCP project name,\n- `\u003cINPUT_TOPIC\u003e` is your Google Cloud Pub/Sub topic name of input,\n- `\u003cOUTPUT_TOPIC\u003e` is your Google Cloud Pub/Sub topic name of output, and\n- `\u003cDATAFLOW_BUCKET`\u003e is your GCS bucket name for Dataflow temporary files.\n\n### Solvers\n\n#### If you would like to use the D-Wave solver\n\nPlease give credentials directly to the `sawatabi.solver.DWaveSolver()` constructor arguments, or set up a config using dwave-cloud-client:\n```\n$ dwave config create\nConfiguration file not found; the default location is: /path/to/your/location/dwave.conf\nConfiguration file path [/path/to/your/location/dwave.conf]:\nConfiguration file path does not exist. Create it? [y/N]: y\nProfile (create new) [prod]: dev\nAPI endpoint URL [skip]: xxxxxxxxxxxxxxxx\nAuthentication token [skip]: xxxxxxxxxxxxxxxx\nDefault client class [skip]:\nDefault solver [skip]: Advantage_system1.1\nConfiguration saved.\n```\n\n#### If you would like to use the Fixstars GPU solver (Optigan)\n\nPlease give credentials directly to the `sawatabi.solver.OptiganSolver()` constructor arguments, or set up a API Token in `~/.optigan.yml`:\n```\napi:\n    endpoint: http://optigan.example.com/method\n    token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n```\n\n### For Contributions to the Sawatabi Framework\n\nPlease set up a development environment as follows:\n```\npython -m venv venv\nsource venv/bin/activate\npip install --upgrade pip\npip install --editable \".[dev]\"\n```\n\n## Acknowledgement\n\nThis work is supported by the MITOU Target program from Information-technology Promotion Agency, Japan (IPA).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotarot%2Fsawatabi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkotarot%2Fsawatabi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotarot%2Fsawatabi/lists"}