用于与d波云资源交互的最小客户端。
dwave-cloud-client的Python项目详细描述
D-Wave云客户端
d-wave云客户端是用于 与d波采样器api(sapi)服务器通信。
SAPI是一个应用程序层,用于提供资源发现、权限和 以及d波系统量子退火资源的调度。 这个包为该层提供了一个最小的python接口 影响交互和工作流的质量。
示例
此示例基于本地 系统自动检测到默认配置文件并对随机ising问题进行采样 适合解算器的图形。
importrandomfromdwave.cloudimportClient# Connect using the default or environment connection informationwithClient.from_config()asclient:# Load the default solversolver=client.get_solver()# Build a random Ising model to exactly fit the graph the solver supportslinear={index:random.choice([-1,1])forindexinsolver.nodes}quad={key:random.choice([-1,1])forkeyinsolver.undirected_edges}# Send the problem for sampling, include solver-specific parameter 'num_reads'computation=solver.sample_ising(linear,quad,num_reads=100)# Print the first sample out of a hundredprint(computation.samples[0])
安装
与python 2和3兼容:
pip install dwave-cloud-client
从源安装(在github的dwavesystems/dwave-cloud-clientrepo中提供):
pip install -r requirements.txt python setup.py install
许可证
在apache许可证2.0下发布。请参阅LICENSE文件。
贡献
请参阅CONTRIBUTING.rst文件。