Wildcat Python SDK to Use Annealers
Project description
[![Build Status](https://travis-ci.org/skonb/wildcat_qdk.svg?branch=feature%2Ftravis_ci)](https://travis-ci.org/skonb/wildcat_qdk)
Wildcat Python SDK
===============================
version number: 0.0.10
author: Shumpei Kobayashi
Overview
--------
Wildcat Python SDK to Use Annealers
Installation / Usage
--------------------
To install use pip:
$ pip install wildcat
Or clone the repo:
$ git clone https://github.com/mdrft/wildcat.git
$ python setup.py install
Contributing
------------
TBD
Example
-------
To find an optimal arrangement with wildcat remote server:
```python
from wildcat.util.matrix import random_symmetric_matrix
from wildcat.solver.ising_hamiltonian_solver import IsingHamiltonianSolver
Jij = random_symmetric_matrix(size=40)
solver = IsingHamiltonianSolver(ising_interactions=Jij)
def callback(arrangement):
e = solver.hamiltonian_energy(arrangement)
print("Energy: ", e)
print("Spins: ", arrangement)
solver.solve(callback)
```
To find an optimal arrangement with local annealer, specify LocalEndpoint:
```python
from wildcat.network.local_endpoint import LocalEndpoint
solver.solve(callback, endpoint=LocalEndpoint())
```
You can adjust annealing strategy:
```python
from wildcat.network.local_endpoint import LocalEndpoint
from wildcat.annealer.simulated.simulated_annealer import SimulatedAnnealer
from wildcat.annealer.simulated.single_spin_flip_strategy import SingleSpinFlipStrategy
from wildcat.annealer.simulated.temperature_schedule import TemperatureSchedule
from wildcat.util.matrix import hamiltonian_energy
def update_callback(q):
print(q)
print(hamiltonian_energy(q))
schedule = TemperatureSchedule(initial_temperature=10, last_temperature=0.1, scale=0.8)
strategy = SingleSpinFlipStrategy(repetition=10, update_callback=update_callback)
annealer = SimulatedAnnealer(schedule=schedule, strategy=strategy)
local_endpoint = LocalEndpoint(annealer=annealer)
```
Wildcat Python SDK
===============================
version number: 0.0.10
author: Shumpei Kobayashi
Overview
--------
Wildcat Python SDK to Use Annealers
Installation / Usage
--------------------
To install use pip:
$ pip install wildcat
Or clone the repo:
$ git clone https://github.com/mdrft/wildcat.git
$ python setup.py install
Contributing
------------
TBD
Example
-------
To find an optimal arrangement with wildcat remote server:
```python
from wildcat.util.matrix import random_symmetric_matrix
from wildcat.solver.ising_hamiltonian_solver import IsingHamiltonianSolver
Jij = random_symmetric_matrix(size=40)
solver = IsingHamiltonianSolver(ising_interactions=Jij)
def callback(arrangement):
e = solver.hamiltonian_energy(arrangement)
print("Energy: ", e)
print("Spins: ", arrangement)
solver.solve(callback)
```
To find an optimal arrangement with local annealer, specify LocalEndpoint:
```python
from wildcat.network.local_endpoint import LocalEndpoint
solver.solve(callback, endpoint=LocalEndpoint())
```
You can adjust annealing strategy:
```python
from wildcat.network.local_endpoint import LocalEndpoint
from wildcat.annealer.simulated.simulated_annealer import SimulatedAnnealer
from wildcat.annealer.simulated.single_spin_flip_strategy import SingleSpinFlipStrategy
from wildcat.annealer.simulated.temperature_schedule import TemperatureSchedule
from wildcat.util.matrix import hamiltonian_energy
def update_callback(q):
print(q)
print(hamiltonian_energy(q))
schedule = TemperatureSchedule(initial_temperature=10, last_temperature=0.1, scale=0.8)
strategy = SingleSpinFlipStrategy(repetition=10, update_callback=update_callback)
annealer = SimulatedAnnealer(schedule=schedule, strategy=strategy)
local_endpoint = LocalEndpoint(annealer=annealer)
```
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 Distribution
wildcat-0.0.13.tar.gz
(8.8 kB
view details)
Built Distribution
File details
Details for the file wildcat-0.0.13.tar.gz
.
File metadata
- Download URL: wildcat-0.0.13.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0004679bc907f9a1f629ee69fa0dbeab5a428a4bf8ea40e67a77f123d30ceb8f |
|
MD5 | 9167992227846e81bad8314f1fbbd4f6 |
|
BLAKE2b-256 | a6716033ab1a4b93803c596059313ed4e8c1d4b42031c6be1fac920af8087eb5 |
File details
Details for the file wildcat-0.0.13-py2.py3-none-any.whl
.
File metadata
- Download URL: wildcat-0.0.13-py2.py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073a6739a83a3a8b48388302747c185606b4324f6b3ea82a5c51f2a36d898d57 |
|
MD5 | 79876e044396908457485995efe918b0 |
|
BLAKE2b-256 | a62dae477ca2bf6d307e297102a8c0790c19387be9105b3ce36a3cce8b3904e2 |