openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
openjij.model.model Namespace Reference

Functions

 make_BinaryQuadraticModel (dict linear, dict quadratic, sparse)
 
 make_BinaryQuadraticModel_from_JSON (dict obj)
 
 BinaryQuadraticModel (linear, quadratic, *args, **kwargs)
 
 bqm_from_numpy_matrix (mat, list variables=None, offset=0.0, vartype="BINARY", **kwargs)
 
 bqm_from_qubo (Q, offset=0.0, **kwargs)
 
 bqm_from_ising (linear, quadratic, offset=0.0, **kwargs)
 
 make_BinaryPolynomialModel (polynomial, index_type=None, tuple_size=0)
 
 make_BinaryPolynomialModel_from_JSON (obj)
 
 BinaryPolynomialModel (*args, **kwargs)
 
 _BinaryPolynomialModel_from_dict (dict polynomial, vartype)
 
 _BinaryPolynomialModel_from_list (list keys, list values, vartype)
 
 make_BinaryPolynomialModel_from_hising (*args, **kwargs)
 
 _make_BinaryPolynomialModel_from_hising_from_dict (dict polynomial)
 
 _make_BinaryPolynomialModel_from_hising_from_list (list keys, list values)
 
 make_BinaryPolynomialModel_from_hubo (*args, **kwargs)
 
 _make_BinaryPolynomialModel_from_hubo_from_dict (dict polynomial)
 
 _make_BinaryPolynomialModel_from_hubo_from_list (list keys, list values)
 
 _to_cxxcimod (vartype)
 

Variables

 from_numpy_matrix
 
 from_qubo
 
 from_ising
 
 from_serializable
 
 from_hising
 
 from_hubo
 
 model_type
 

Detailed Description

| This module defines the BinaryQuadraticModel with the Hamiltonian,

.. math::

    H = \\sum_{i\\neq j} J_{ij}\\sigma_i \\sigma_j + \\sum_{i} h_{i}\\sigma_i,

| in an Ising form and

.. math::

    H = \\sum_{ij} Q_{ij}x_i x_j + \\sum_{i} H_{i}x_i,

| in a QUBO form.
| The methods and usage are basically the same as `dimod <https://github.com/dwavesystems/dimod>`_.

Function Documentation

◆ _BinaryPolynomialModel_from_dict()

openjij.model.model._BinaryPolynomialModel_from_dict ( dict  polynomial,
  vartype 
)
protected

References openjij.model.model._to_cxxcimod().

Referenced by openjij.model.model.BinaryPolynomialModel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _BinaryPolynomialModel_from_list()

openjij.model.model._BinaryPolynomialModel_from_list ( list  keys,
list  values,
  vartype 
)
protected

References openjij.model.model._to_cxxcimod().

Referenced by openjij.model.model.BinaryPolynomialModel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _make_BinaryPolynomialModel_from_hising_from_dict()

openjij.model.model._make_BinaryPolynomialModel_from_hising_from_dict ( dict  polynomial)
protected

References openjij.model.model.from_hising.

Referenced by openjij.model.model.make_BinaryPolynomialModel_from_hising().

Here is the caller graph for this function:

◆ _make_BinaryPolynomialModel_from_hising_from_list()

openjij.model.model._make_BinaryPolynomialModel_from_hising_from_list ( list  keys,
list  values 
)
protected

References openjij.model.model.from_hising.

Referenced by openjij.model.model.make_BinaryPolynomialModel_from_hising().

Here is the caller graph for this function:

◆ _make_BinaryPolynomialModel_from_hubo_from_dict()

openjij.model.model._make_BinaryPolynomialModel_from_hubo_from_dict ( dict  polynomial)
protected

References openjij.model.model.from_hubo.

Referenced by openjij.model.model.make_BinaryPolynomialModel_from_hubo().

Here is the caller graph for this function:

◆ _make_BinaryPolynomialModel_from_hubo_from_list()

openjij.model.model._make_BinaryPolynomialModel_from_hubo_from_list ( list  keys,
list  values 
)
protected

References openjij.model.model.from_hubo.

Referenced by openjij.model.model.make_BinaryPolynomialModel_from_hubo().

Here is the caller graph for this function:

◆ _to_cxxcimod()

openjij.model.model._to_cxxcimod (   vartype)
protected

◆ BinaryPolynomialModel()

openjij.model.model.BinaryPolynomialModel ( args,
**  kwargs 
)

◆ BinaryQuadraticModel()

openjij.model.model.BinaryQuadraticModel (   linear,
  quadratic,
args,
**  kwargs 
)
Generate BinaryQuadraticModel object.

Attributes:
    vartype (dimod.Vartype): variable type SPIN or BINARY
    linear (dict): represents linear term
    quadratic (dict): represents quadratic term
    offset (float): represents constant energy term when convert to SPIN from BINARY
    num_variables (int): represents number of variables in the model
    variables (list): represents variables of the binary quadratic model
Args:
    linear (dict): linear biases
    quadratic (dict): quadratic biases
    offset (float): offset
    vartype (openjij.variable_type.Vartype): vartype ('SPIN' or 'BINARY')
    kwargs:
Returns:
    generated BinaryQuadraticModel
Examples:
    BinaryQuadraticModel can be initialized by specifing h and J::

        >>> h = {0: 1, 1: -2}
        >>> J = {(0, 1): -1, (1, 2): -3, (2, 3): 0.5}
        >>> bqm = oj.BinaryQuadraticModel(self.h, self.J)

    You can also use strings and tuples of integers (up to 4 elements) as indices::

        >>> h = {'a': 1, 'b': -2}
        >>> J = {('a', 'b'): -1, ('b', 'c'): -3, ('c', 'd'): 0.5}
        >>> bqm = oj.BinaryQuadraticModel(self.h, self.J)

◆ bqm_from_ising()

openjij.model.model.bqm_from_ising (   linear,
  quadratic,
  offset = 0.0,
**  kwargs 
)

◆ bqm_from_numpy_matrix()

openjij.model.model.bqm_from_numpy_matrix (   mat,
list   variables = None,
  offset = 0.0,
  vartype = "BINARY",
**  kwargs 
)

◆ bqm_from_qubo()

openjij.model.model.bqm_from_qubo (   Q,
  offset = 0.0,
**  kwargs 
)

◆ make_BinaryPolynomialModel()

openjij.model.model.make_BinaryPolynomialModel (   polynomial,
  index_type = None,
  tuple_size = 0 
)

◆ make_BinaryPolynomialModel_from_hising()

openjij.model.model.make_BinaryPolynomialModel_from_hising ( args,
**  kwargs 
)

◆ make_BinaryPolynomialModel_from_hubo()

openjij.model.model.make_BinaryPolynomialModel_from_hubo ( args,
**  kwargs 
)

◆ make_BinaryPolynomialModel_from_JSON()

openjij.model.model.make_BinaryPolynomialModel_from_JSON (   obj)

◆ make_BinaryQuadraticModel()

openjij.model.model.make_BinaryQuadraticModel ( dict  linear,
dict  quadratic,
  sparse 
)
BinaryQuadraticModel factory.

Returns:
    generated BinaryQuadraticModel class

◆ make_BinaryQuadraticModel_from_JSON()

openjij.model.model.make_BinaryQuadraticModel_from_JSON ( dict  obj)
Make BinaryQuadraticModel from JSON.

Returns:
    corresponding BinaryQuadraticModel type

Variable Documentation

◆ from_hising

◆ from_hubo

◆ from_ising

openjij.model.model.from_ising

◆ from_numpy_matrix

openjij.model.model.from_numpy_matrix

◆ from_qubo

openjij.model.model.from_qubo

◆ from_serializable

openjij.model.model.from_serializable

◆ model_type

openjij.model.model.model_type