|
| 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) |
|
| 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>`_.
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)