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.17
  • (optional) Ninja

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 want to use setup.py instead of PIP, You will need to install CMake>=3.17.
We are Highly recommended install CMake via PYPI.

$ pip install -U cmake
  • 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.17/cmake-3.17.5.tar.gz
$ tar xvf cmake-3.17.5.tar.gz
$ cd cmake-3.17.5
$ ./bootstrap && make && sudo make install 
  • Windows

Please install cmake from here.

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 -m pip install .

Test

Test only Python code

$ python setup.py test

Test Python and C++ code

$ export USE_TEST=1
$ python setup.py test

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

openjij-0.4.0-cp39-cp39-win_amd64.whl (677.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

openjij-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (671.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

openjij-0.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (624.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

openjij-0.4.0-cp39-cp39-macosx_11_0_arm64.whl (505.8 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

openjij-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl (547.9 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

openjij-0.4.0-cp38-cp38-win_amd64.whl (677.7 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

openjij-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (671.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

openjij-0.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (622.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

openjij-0.4.0-cp38-cp38-macosx_11_0_arm64.whl (505.8 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

openjij-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl (547.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

openjij-0.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (687.0 kB view hashes)

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

openjij-0.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (632.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

openjij-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl (540.8 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ 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