cim-optimizer

Reference implementation of a simulator of multiple variants of the Coherent Ising Machine (CIM).

https://github.com/mcmahon-lab/cim-optimizer

Science Score: 75.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
    Organization mcmahon-lab has institutional domain (mcmahon.aep.cornell.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Reference implementation of a simulator of multiple variants of the Coherent Ising Machine (CIM).

Basic Info
  • Host: GitHub
  • Owner: mcmahon-lab
  • License: cc-by-4.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 35.7 MB
Statistics
  • Stars: 34
  • Watchers: 4
  • Forks: 7
  • Open Issues: 2
  • Releases: 0
Created over 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

cim-optimizer

tests License: CC BY 4.0

This repository contains a reference implementation of a simulator of the Coherent Ising Machine (CIM). For more information, please see the documentation.

The CIM was developed as a photonic machine for heuristically solving Ising-optimization problems. Simulations of the CIM can be thought of as an unconventional, dynamical-systems-based, heuristic algorithm for solving Ising problems, which can compete with more conventional Ising-solving algorithms (such as simulated annealing, parallel tempering, and branch-and-bound).

There are two main intended audiences for this repository: 1. People who would like to use a state-of-the-art implementation of the CIM algorithm to heuristically solve Ising problems (for example, to benchmark the CIM approach against other heuristic approaches). 2. People who would like to study the workings of the CIM approach through simulation, and/or would like to have a quantitative model of CIM performance to make predictions about how future CIM hardware implementations will perform.

Most of the code in this repository resides within a Python file solve_Ising.py. This repository is written in Python, and all input and result data for users is formatted in NumPy, while the source code uses PyTorch libraries for GPU acceleration. Several demonstration notebooks are provided in the notebooks directory, and showcase how to configure and run the solver function.

The goal of the CIM (and its simulation and variants) is to heuristically optimize the following $N$-variable objective function (the classical $N$-spin Ising Hamiltonian):

$$ H = -\sum{1\leq i < j \leq N} J{ij}\sigmai \sigmaj - \sum{1 \leq i \leq N} hi \sigma_i$$

where $J$ is an $N \times N$ coupling matrix and $h$ is an $N$-dimensional vector representing the Zeeman external field. Each Ising spin is represented as $\sigma_i \in$ { $-1, 1$ }.

This repository uses solver algorithms adapted from: - Discrete-Time Measurement-Feedback Coherent Ising Machine

P.L. McMahon, A. Marandi, Y. Haribara, R. Hamerly, C. Langrock, S. Tamate, T. Inagaki, H. Takesue, S. Utsunomiya, K. Aihara, R.L. Byer, M.M. Fejer, H. Mabuchi, Y. Yamamoto. A fully programmable 100-spin coherent Ising machine with all-to-all connections. Science 354, No. 6312, 614 - 617 (2016). https://doi.org/10.1126/science.aah5178 - Amplitude-Heterogeneity-Correction variant of the CIM algorithm T. Leleu, Y. Yamamoto, P.L. McMahon, and K. Aihara, Destabilization of local minima in analog spin systems by correction of amplitude heterogeneity. Physical Review Letters 122, 040607 (2019). https://doi.org/10.1103/PhysRevLett.122.040607 - Chaotic-Amplitude-Control variant of the CIM algorithm T. Leleu, F. Khoyratee, T. Levi, R. Hamerly, T. Kohno, K. Aihara. Scaling advantage of chaotic amplitude control for high-performance combinatorial optimization. Commun Phys 4, 266 (2021). https://doi.org/10.1038/s42005-021-00768-0

All of the algorithms implemented are for classical models of the CIM. See https://doi.org/10.1364/QIM.2017.QW3B.2 and https://doi.org/10.1117/12.2613817 for examples of discussions of quantum models of the CIM, which are not implemented in this repository.

Please see the references within the cited papers for a fuller picture of the history and development of the Coherent-Ising-Machine approach to heuristically solving Ising problems, which was begun at Stanford University in the group of Yoshihisa Yamamoto circa 2010.

Getting Started (The Short Version)

Installation

pip install cim-optimizer

Usage

from cim_optimizer.solve_Ising import * import numpy as np N = 20 # number of spins J = np.random.randint(-100,100,size=(N,N)) # spin-spin-coupling matrix of a random Ising instance J = J + J.T # ensure the matrix J is symmetric np.fill_diagonal(J, 0) # ensure diagonal elements of the coupling matrix J are zero h = np.random.randint(-100,100,size=(N)) # external-field vector of a random Ising instance solution = Ising(J, h).solve() print(solution)

Getting Started (The Longer Version)

  • For background on CIMs, metadata, and GPU acceleration check out Example 1.
  • Hyperparameters and hyperparameter tuning (with BOHB) is showcased in Example 2.
  • An example solving the Maritime Inventory Routing Problem, which with the Ising mapping used, includes non-zero external-field terms Example 3.

Requirements

  • Requires Python Version >= 3.7
  • Requires PyTorch Version 1.12.1 to be compiled with CUDA 11.6 (for GPU acceleration). See Pytorch's installation page for more information.
  • Requires BOHB-HPO Version 0.5.2
  • For an exhaustive list of requirements, see the requirements.txt file.

Contributors

Francis Chen, Brian Isakov, Tyler King, Timothée Leleu, Tatsuhiro Onodera, Peter McMahon

Funding acknowledgements

The development of this open-source implementation of CIM algorithm variants was partially supported by an NSF Expeditions award (CCF-1918549).

How to cite

If you use this code in your research, please consider citing it. You can retrieve an APA or BibTeX citation by clicking 'Cite this repository' on the sidebar in GitHub, or you can view the raw citation data in CITATION.cff.

License

The code in this repository is released under the following license:

Creative Commons Attribution 4.0 International

A copy of this license is given in this repository as license.txt.

Owner

  • Name: McMahon Lab
  • Login: mcmahon-lab
  • Kind: organization

Citation (CITATION.cff)

authors:
  - family-names: Chen
    given-names: Francis
  - family-names: Isakov
    given-names: Brian
  - family-names: King
    given-names: Tyler
  - family-names: Leleu
    given-names: Timothée
  - family-names: McMahon
    given-names: Peter
  - family-names: Onodera
    given-names: Tatsuhiro
cff-version: 1.2.0
date-released: 2022-10-25
message: "If you use this software, please cite it using the metadata from this file."
title: "cim-optimizer: a simulator of the Coherent Ising Machine"
repository-code: "https://github.com/mcmahon-lab/cim-optimizer"

GitHub Events

Total
  • Watch event: 10
  • Pull request event: 1
  • Fork event: 1
Last Year
  • Watch event: 10
  • Pull request event: 1
  • Fork event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 11
  • Total Committers: 2
  • Avg Commits per committer: 5.5
  • Development Distribution Score (DDS): 0.455
Top Committers
Name Email Commits
tylertking t****3@g****m 6
Francis Chen f****8@c****u 5
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 3
  • Total pull requests: 2
  • Average time to close issues: 4 days
  • Average time to close pull requests: 10 minutes
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 1.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 10 minutes
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • robliou (2)
  • idnm (1)
Pull Request Authors
  • tylertking (2)
  • pedromxavier (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 56 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
pypi.org: cim-optimizer

Simulated Implementation of the Coherent Ising Machine

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 56 Last month
Rankings
Dependent packages count: 6.6%
Stargazers count: 14.9%
Average: 21.9%
Downloads: 26.9%
Forks count: 30.5%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 7 months ago

Dependencies

docs/requirements.txt pypi
  • BOHB_HPO ==0.5.2
  • docutils ==0.16
  • matplotlib ==3.5.2
  • nbsphinx *
  • nbsphinx-link *
  • numpy ==1.21.5
  • numpydoc *
  • sphinx *
  • sphinx_rtd_theme >=0.3.1
  • sphinxcontrib-napoleon *
  • torch ==1.12.1
requirements.txt pypi
  • BOHB_HPO ==0.5.2
  • matplotlib ==3.5.2
  • numpy ==1.21.5
  • torch ==1.12.1
setup.py pypi
  • BOHB_HPO *
  • matplotlib *
  • numpy *
  • torch *
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
cim_optimizer/setup.py pypi