openjij.model.chimera_model#

Module Contents#

Functions#

ChimeraModel([linear, quadratic, offset, vartype, ...])

Generate ChimeraModel object

make_ChimeraModel(linear, quadratic)

ChimeraModel factory.

make_ChimeraModel_from_JSON(obj)

Make ChimeraModel from JSON.

Attributes#

from_ising

from_qubo

from_serializable

openjij.model.chimera_model.from_ising#
openjij.model.chimera_model.from_qubo#
openjij.model.chimera_model.from_serializable#
openjij.model.chimera_model.ChimeraModel(linear: dict = None, quadratic: dict = None, offset: float = 0.0, vartype=SPIN, unit_num_L: int = None, model=None, gpu: bool = False)[source]#

Generate ChimeraModel object

This model deal with chimera graph. ChimeraModel provide methods to verify whether a given interaction graph matches a Chimera graph and to convert it to cxxjij.graph.Chimera.

Parameters
  • linear (dict) – linear biases

  • quadratic (dict) – quadratic biases

  • offset (float) – offset

  • vartype – vartype (‘SPIN’ or ‘BINARY’)

  • unit_num_L (int) – unit_num_L

  • model (BinaryQuadraticModel) – if model is not None, the object is initialized by model.

  • gpu (bool) – if true, this can be used for gpu samplers.

Returns

generated ChimeraModel

Examples

Example shows how to initialize ChimeraModel.:

# This interactions satisfy chimera topology.
>>> Q={(0, 4): -1, (4, 12): -1}
>>> chimera_model = ChimeraModel(Q, unit_num_L=2)  # make
>>> chimera_self.validate_chimera()
openjij.model.chimera_model.make_ChimeraModel(linear, quadratic)[source]#

ChimeraModel factory.

Returns

generated ChimeraModel class

openjij.model.chimera_model.make_ChimeraModel_from_JSON(obj)[source]#

Make ChimeraModel from JSON.

Returns

corresponding ChimeraModel type