Computing Modes of the Special-Purpose Quantum Computing Cloud Platform#
A computing paradigm is the framework through which users interact with a quantum computer. It determines how the system processes user optimization problems, allocates computing resources, and presents final results. Choosing the right computing mode is like choosing the right driving mode for different road conditions.
Special-purpose quantum computing supports two computing modes: Optimization mode and Sampling mode. Optimization mode automatically balances computing efficiency and result quality, making it suitable for most business scenarios. Sampling mode explores the solution space through extensive sampling and is suitable for tasks that need to find high-quality solutions from a large solution set.
Sampling Mode#
Computing Mode Definition#
Sampling mode requires users to specify the number of computing iterations (sample_number). In each iteration, the system continuously samples the solution space through special-purpose quantum energy evolution and eventually converges to a low-energy state. The core of Sampling mode is exploring the solution space through extensive sampling, making it suitable for tasks that need to find high-quality solutions from a large solution set.
This mode is suitable for sampling tasks over a massive solution space and is more stochastic than Optimization mode.
Parameter Description#
task_mode: set to
TaskMode.SAMPLINGsample_number: number of samples, ranging from 10 to 2000, with a default value of 10. This parameter is required only in Sampling mode.
Applicable Scenarios#
For research scenarios that are sensitive to computing time cost and have relatively relaxed requirements for solution quality. Typical applications include:
Artificial intelligence: Boltzmann machine training
Biopharmaceuticals: mRNA vaccine sequence optimization, molecule generation, and more
Code Example#
import numpy as np
import kaiwu as kw
from kaiwu.cim import CIMOptimizer, TaskMode
kw.common.CheckpointManager.save_dir = "/tmp"
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 = CIMOptimizer(
task_name="cim_sampling_test", task_mode=TaskMode.SAMPLING, sample_number=100
)
solution = optimizer.solve(matrix)
Optimization Mode#
Computing Mode Definition#
Optimization mode is designed to help users balance computing efficiency and result quality. Based on a dynamic strategy algorithm, it adjusts the number of special-purpose quantum evolution computations, quickly producing results for simple models while continuously adding computing resources for difficult tasks to ensure solution quality. Meanwhile, all candidate solutions sampled across multiple computations undergo multi-layer data post-processing, such as energy sorting and clustering analysis, to select stable and reliable optimal solutions from a massive solution set.
Parameter Description#
task_mode: set to
TaskMode.OPTIMIZATION
Applicable Scenarios#
Suitable for computing scenarios that are sensitive to result quality but have relaxed timeliness requirements:
Biopharmaceuticals: drug discovery, such as allosteric site identification and molecular similarity screening
Finance: credit scoring feature selection, community detection, and anti-fraud detection
Code Example#
import numpy as np
import kaiwu as kw
from kaiwu.cim import CIMOptimizer, TaskMode
kw.common.CheckpointManager.save_dir = "/tmp"
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 = CIMOptimizer(
task_name="cim_optimization_test", task_mode=TaskMode.OPTIMIZATION
)
solution = optimizer.solve(matrix)