Kaiwu SDK Enterprise
Kaiwu SDK Enterprise is a Python SDK for building and solving QUBO and Ising optimization problems with Kaiwu classical optimizers and CIM services.
This package is the enterprise distribution. A valid license is required before using licensed features.
Requirements
- Python >= 3.10
- Windows, Linux, or macOS
Installation
Install from PyPI:
pip install kaiwu
Install a specific version:
pip install kaiwu==1.4.1
Quick Start
Solve an Ising Matrix
import numpy as np
import kaiwu as kw
matrix = -np.array(
[
[0.0, 1.0, 0.0, 1.0, 1.0],
[1.0, 0.0, 0.0, 1.0, 1.0],
[0.0, 0.0, 0.0, 1.0, 1.0],
[1.0, 1.0, 1.0, 0.0, 1.0],
[1.0, 1.0, 1.0, 1.0, 0.0],
]
)
optimizer = kw.classical.SimulatedAnnealingOptimizer(
initial_temperature=100,
alpha=0.99,
cutoff_temperature=0.001,
iterations_per_t=10,
size_limit=10,
)
solutions = optimizer.solve(matrix)
print(solutions)
Solve a QUBO Matrix
solve_qubo() accepts a QuboModel. If you already have a QUBO matrix, convert it first:
import numpy as np
import kaiwu as kw
qubo_matrix = -np.array(
[
[0.0, -1.0, 0.0, 1.0, 1.0],
[-1.0, 0.0, 0.0, 1.0, 1.0],
[0.0, 0.0, 0.0, 1.0, 1.0],
[1.0, 1.0, 1.0, 0.0, 1.0],
[1.0, 1.0, 1.0, 1.0, 0.0],
]
)
# QUBO matrix conversion uses the upper-triangular convention.
qubo_model = kw.core.qubo_matrix_to_qubo_model(np.triu(qubo_matrix))
optimizer = kw.classical.SimulatedAnnealingOptimizer(
initial_temperature=100,
alpha=0.99,
cutoff_temperature=0.001,
iterations_per_t=10,
size_limit=10,
)
solution, objective = optimizer.solve_qubo(qubo_model)
print(solution)
print(objective)
Use CIMOptimizer
CIMOptimizer submits or queries CIM tasks. Set a checkpoint directory before creating the optimizer.
import numpy as np
import kaiwu as kw
kw.common.CheckpointManager.save_dir = "tmp"
qubo_matrix = np.array(
[
[0.0, 1.0, 0.0],
[0.0, 0.0, -2.0],
[0.0, 0.0, 0.0],
]
)
qubo_model = kw.core.qubo_matrix_to_qubo_model(np.triu(qubo_matrix))
optimizer = kw.cim.CIMOptimizer(
task_name="qubo_cim_example",
wait=False,
task_mode=kw.cim.TaskMode.OPTIMIZATION,
)
solution, objective = optimizer.solve_qubo(qubo_model)
print(solution, objective)
When wait=False, unfinished tasks may return (None, None). Use wait=True if the program should wait for the task result.
Main Modules
kaiwu.classical: classical optimizers, including simulated annealing, tabu search, and brute force searchkaiwu.cim: CIM task optimizer and task modeskaiwu.preprocess: matrix precision analysis and precision reduction toolskaiwu.hybrid: hybrid optimization toolskaiwu.sampler: sampler implementationskaiwu.hobo: higher-order binary optimization tools
Logging
Enable debug logs when needed:
import kaiwu as kw
kw.common.set_log_level("DEBUG")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kaiwu-1.4.1-cp310-none-win_amd64.whl.
File metadata
- Download URL: kaiwu-1.4.1-cp310-none-win_amd64.whl
- Upload date:
- Size: 653.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55b11a491232bda40d13396c0d0b4409b594092510ef0ff50d973893d35a694
|
|
| MD5 |
04dacbc87f4e90877378b71c88598b9c
|
|
| BLAKE2b-256 |
032b08322761867b49199fc510996d96b595bab0985b349440192f5b992bdd92
|
File details
Details for the file kaiwu-1.4.1-cp310-none-manylinux1_x86_64.whl.
File metadata
- Download URL: kaiwu-1.4.1-cp310-none-manylinux1_x86_64.whl
- Upload date:
- Size: 906.2 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
935981db1993783b12dd20e01df4df9ec132f499dd12e2ef907bda414f2223c1
|
|
| MD5 |
7ff2aefdd381d309d291a62dc23ee40d
|
|
| BLAKE2b-256 |
127b31cde65d7b96c32a0867898b7c38f6a3def85a243aaecd921a98aed9dc29
|
File details
Details for the file kaiwu-1.4.1-cp310-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: kaiwu-1.4.1-cp310-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 684.7 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72ee8afd01da88a10696c79e6d5de43a2a533ce712ccb5b880b1d9030f70e6f8
|
|
| MD5 |
c28986b6c0158b5add4b560c3c32885d
|
|
| BLAKE2b-256 |
4e32ab30471d7da64a20b4b727218ed7df0c0b2442a169722b7d226b723d8147
|
File details
Details for the file kaiwu-1.4.1-cp310-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: kaiwu-1.4.1-cp310-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 703.2 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f4fe4c37559d372d7dd53f3b56be82715c736f482b98e76d0298eeeb2a1cd5a
|
|
| MD5 |
15bcd0317ae920499769fa383a8461fe
|
|
| BLAKE2b-256 |
319a6fe0f8c6b151fea5b07f6dbc2f6e82213bf95a1632143db33a0b63cccc43
|