Skip to main content

Framework for the Ising model and QUBO

Project description

OpenJij : Framework for the Ising model and QUBO.

build-test

  • python >= 3.7
  • (optional) gcc >= 7.0.0
  • (optional) cmake >= 3.12.2

install

install via pip

Note: To use GPGPU algorithms, please follow the section install via pip from source codes below. GPGPU algorithms are automatically enabled once CMake finds CUDA frameworks during installation.

$ pip install openjij

install via pip from source codes

To install OpenJij from source codes, please install CMake first then install OpenJij.

cmake setup

If you had not installed cmake>=3.12.2, you need install cmake>=3.12.2

  • macOS
$ brew install cmake
  • Linux
# if you installed old version by apt-get
$ apt-get purge cmake

# install cmake 
$ wget https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz
$ tar xvf cmake-3.13.2.tar.gz
$ cd cmake-3.13.2
$ ./bootstrap && make && sudo make install 
  • Windows

Please install cmake from here.

Alternatively, you can use

$ pip install -U cmake

Make sure the enviroment path for CMake is set correctly.

install OpenJij

$ pip install openjij --no-binary :all:

install from github repository

$ git clone git@github.com:OpenJij/OpenJij.git
$ cd openjij
$ python setup.py install

How to use

Python example

import openjij as oj
sampler = oj.SASampler()
response = sampler.sample_ising(h={0: -1}, J={(0,1): -1})
response.states
# [[1,1]]

# with indices
response = sampler.sample_ising(h={'a': -1}, J={('a','b'): 1})
[{index: s for index, s in zip(response.indices, state)} for state in response.states]
# [{'b': -1, 'a': 1}]

C++ example

$ source ./build_gcc.sh
$ cd ./project_template
$ make
$ ./tutorial
The result spins are [1 1 1 1 1 ]

Community

About us

This product is maintained by Jij Inc.

Please visit our website for more information! https://j-ij.com/

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

openjij-0.3.3.tar.gz (273.1 kB view hashes)

Uploaded Source

Built Distributions

openjij-0.3.3-cp39-cp39-win_amd64.whl (310.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

openjij-0.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (561.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

openjij-0.3.3-cp39-cp39-macosx_10_15_x86_64.whl (463.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.15+ x86-64

openjij-0.3.3-cp38-cp38-win_amd64.whl (309.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

openjij-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (562.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

openjij-0.3.3-cp38-cp38-macosx_10_15_x86_64.whl (463.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

openjij-0.3.3-cp37-cp37m-win_amd64.whl (305.5 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

openjij-0.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (575.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

openjij-0.3.3-cp37-cp37m-macosx_10_15_x86_64.whl (450.1 kB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page