Python Interface for Jij-Zept
Project description
JijZept Quick Start
How to get started with JijZept
The minimal sample code as follows:
from jijzept import JijSASampler
# define QUBO
qubo = {(0,0): -1, (0, 1): -1, (1, 0): 2}
sampler = JijSASampler(config='config.toml')
result = sampler.sample_qubo(qubo)
print(result)
Write a configuration file for connecting to JijZept in config.toml
and put it in the config
argument of the Sampler constructor.
The configuration file should be written in TOML format as follows.
[default]
url = "***"
token = "****"
Copy and paste the assigned API endpoint into the url
and your token into token
in the configure file.
またデフォルトでは同期モード
になっているため、APIに投げて計算が終わるで待ってから解を得ることになります。
同期モード
をオフにして非同期でJijZeptを使うには以下の手順で答えを得ることができます。
async mode
非同期モードでAPIを使いたい場合は、.sample_*
の引数で、async=False
にして同期モードをオフにする必要があります。
サンプルコード
from jijzept import JijSASampler
from jijzept import api
# define qubo
qubo = {(0, 0): -1, (0, 1): -1, (1, 0): 2}
sampler = JijSASampler(config='config.toml')
# set sync=False
response = sampler.sample_qubo(qubo, sync=False)
# get result
response = response.get_result(config='config.toml')
if response.status == api.SUCESS:
print(response)
elif response.status == api.PENDING:
print('Solver status: PENDING')
else:
print('Error')
非同期モードでも .sample_*
の返り値は 同期モード
と同じくSampleSet
クラスです。
ですが、解が入っていない可能性があります(非同期モードでも一度だけ解を取りに行っているので計算時間が短いと解をもっている可能性もあります)。
解を取りに行くためのコードが
response = response.get_result(config='config.toml')
です。.get_result
の引数config
に認証情報を記述した設定ファイルを指定するのを忘れないでください。
また.get_result
は返り値をもつ非破壊メソッドです。
計算が終了したかどうかはget_result
の返り値の.status
変数で確認することができます。
from jijzept import api
if response.status == api.SUCESS:
print(response)
elif response.status == api.PENDING:
print('Solver status: PENDING')
else:
print('Error')
Available solvers
-
JijSASampler
- Hardware: CPU
- Algorihtm: (Standard) Simulated annealing
- Problem Type: Binary quadratic model (Ising or QUBO)
-
JijSQASampler
- Hardware: CPU
- Algorithm: (Standard) Simulated quantum annealing
- Problem Type: Binary quadratic model (Ising or QUBO)
-
JijSBMSampler
- Hardware: GPU
- Algorithm: TOSHIBA SBM
-
JijDWaveSampler
- Hardware: D-Wave QPU
- Algorithm: Quantum annealing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for jijzept-1.5.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e5e22478105fc3daa8e3775b03313b5e65e73480cbd06d2ccf5299591496c8f |
|
MD5 | 3c67ab63ae0cd81af0d64436614eb232 |
|
BLAKE2b-256 | a88a38c7d89141c5142a32f240473a982ba267285030d0abbb6f119a37dd4748 |
Hashes for jijzept-1.5.0-py3-none-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 860f5e1a26f8e1c8bf2123a60886019b0303113af015e73e338ef606bd4b5689 |
|
MD5 | c93965dc52f4799c5a4350e86ea995e2 |
|
BLAKE2b-256 | 40764c20764e05d80b3f060e1fc1d72f54d5233730deba32ffe2098a4906976c |
Hashes for jijzept-1.5.0-py3-none-manylinux_2_24_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bf4ca347f1883157fb3e046019607e28f89d85d3070b7d845e318695f8151bd |
|
MD5 | 1fcd04a0a89e0e900c44f03c989b2f5f |
|
BLAKE2b-256 | 7f2ddb2ecc19704f421cb90912d217f9966cd0aa4cf89ae631daa09c3adf1e57 |
Hashes for jijzept-1.5.0-py3-none-manylinux_2_24_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04e4b54888c470d429e89c3291e6a0872df40afbd8ea5b8527773f7c751fb928 |
|
MD5 | 6de4ec18f3d635e56f5f60d95be789fe |
|
BLAKE2b-256 | be31a273d880458e925edfe97f55acaf88273c61241aecd9822d5b008485be3a |
Hashes for jijzept-1.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 410705508b895ddc821b61679f1f46fc122f33af58fc2c8e46cb53f637351b80 |
|
MD5 | dbf45865384814740436fbba4bfd47fe |
|
BLAKE2b-256 | 90dc72e2c2f2612bd745e6047895c505d27297e7c9326ce1cb607155cc733796 |
Hashes for jijzept-1.5.0-py3-none-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fd8452ef6549d30987c0b7aa1045f2865dca5b9dcfb7c401d794690ad81ad0d |
|
MD5 | a0268782acbb47b716da06b0afa77ea5 |
|
BLAKE2b-256 | f8e4e5ef139287b0be087cb7107b1aaeded0ae50c5af1600cb2ada54b937de0a |
Hashes for jijzept-1.5.0-py3-none-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df00660760d08fd873ba3cdc4384f645e5a9bcddb425d552bdd879243364ec17 |
|
MD5 | 0b5a19344dc7208bbef632d0c0341c10 |
|
BLAKE2b-256 | 89327b847599c99994ecee5d12e897ca8f577750b47da2d98c3fcefbd6207bb4 |