dimod.BinaryQuadraticModel.binary¶
-
BinaryQuadraticModel.binary¶ BinaryQuadraticModel– An instance of the QUBO model subclass of theBinaryQuadraticModelsuperclass, corresponding to a binary quadratic model with binary variables.Enables access to biases for the binary-valued binary quadratic model regardless of the
vartypeset when the model was created. If the model was created with thespinvartype, the QUBO model subclass is instantiated upon the first use of thebinaryproperty and used in any subsequent reads.Examples
This example creates an Ising model and uses the
binaryproperty to instantiate the corresponding QUBO model.>>> import dimod >>> bqm_spin = dimod.BinaryQuadraticModel({0: 0.0, 1: 0.0}, {(0, 1): 0.5}, -0.5, dimod.SPIN) >>> bqm_qubo = bqm_spin.binary >>> bqm_qubo BinaryQuadraticModel({0: -1.0, 1: -1.0}, {(0, 1): 2.0}, 0.0, Vartype.BINARY) >>> bqm_qubo.binary is bqm_qubo True
Note
Methods like
add_variable(),add_variables_from(),add_interaction(), etc. should only be used on the base model.