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
str model_type = "openjij.BinaryQuadraticModel"

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 _to_cxxcimod(), and make_BinaryPolynomialModel().

Referenced by 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 _to_cxxcimod(), and make_BinaryPolynomialModel().

Referenced by 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 from_hising, and make_BinaryPolynomialModel().

Referenced by make_BinaryPolynomialModel_from_hising().

Here is the call graph for this function:
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 from_hising, and make_BinaryPolynomialModel().

Referenced by make_BinaryPolynomialModel_from_hising().

Here is the call graph for this function:
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 from_hubo, and make_BinaryPolynomialModel().

Referenced by make_BinaryPolynomialModel_from_hubo().

Here is the call graph for this function:
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 from_hubo, and make_BinaryPolynomialModel().

Referenced by make_BinaryPolynomialModel_from_hubo().

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

◆ _to_cxxcimod()

openjij.model.model._to_cxxcimod ( vartype)
protected

References from_serializable, and make_BinaryPolynomialModel_from_JSON().

Referenced by _BinaryPolynomialModel_from_dict(), _BinaryPolynomialModel_from_list(), and BinaryPolynomialModel().

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

◆ BinaryPolynomialModel()

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

References _BinaryPolynomialModel_from_dict(), _BinaryPolynomialModel_from_list(), and _to_cxxcimod().

Here is the call graph for this function:

◆ 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)

References make_BinaryQuadraticModel().

Here is the call graph for this function:

◆ bqm_from_ising()

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

References from_ising, and make_BinaryQuadraticModel().

Here is the call graph for this function:

◆ bqm_from_numpy_matrix()

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

References from_numpy_matrix, and make_BinaryQuadraticModel().

Here is the call graph for this function:

◆ bqm_from_qubo()

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

References from_qubo, and make_BinaryQuadraticModel().

Here is the call graph for this function:

◆ make_BinaryPolynomialModel()

◆ 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)

References make_BinaryPolynomialModel().

Referenced by _to_cxxcimod().

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

◆ make_BinaryQuadraticModel()

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

Returns:
    generated BinaryQuadraticModel class

Referenced by BinaryQuadraticModel(), bqm_from_ising(), bqm_from_numpy_matrix(), bqm_from_qubo(), and make_BinaryQuadraticModel_from_JSON().

Here is the caller graph for this function:

◆ make_BinaryQuadraticModel_from_JSON()

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

Returns:
    corresponding BinaryQuadraticModel type

References make_BinaryQuadraticModel().

Here is the call graph for this function:

Variable Documentation

◆ from_hising

◆ from_hubo

◆ from_ising

openjij.model.model.from_ising

Referenced by bqm_from_ising().

◆ from_numpy_matrix

openjij.model.model.from_numpy_matrix

Referenced by bqm_from_numpy_matrix().

◆ from_qubo

openjij.model.model.from_qubo

Referenced by bqm_from_qubo().

◆ from_serializable

openjij.model.model.from_serializable

Referenced by _to_cxxcimod().

◆ model_type

str openjij.model.model.model_type = "openjij.BinaryQuadraticModel"