def to_qubo(self):
        """Convert a binary quadratic model to QUBO format.

        If the binary quadratic model's vartype is not :class:`.Vartype.BINARY`,
        values are converted.

        Returns:
            tuple: 2-tuple of form (`biases`, `offset`), where `biases` is a dict
            in which keys are pairs of variables and values are the associated linear or
            quadratic bias and `offset` is a number that represents the constant offset
            of the binary quadratic model.

        Examples:
            This example converts a binary quadratic model with spin variables to QUBO format
            with binary variables.

            >>> import dimod
            >>> model = dimod.BinaryQuadraticModel({0: 1, 1: -1, 2: .5},
            ...                                    {(0, 1): .5, (1, 2): 1.5},
            ...                                    1.4,
            ...                                    dimod.SPIN)
            >>> model.to_qubo()   # doctest: +SKIP
            ({(0, 0): 1.0, (0, 1): 2.0, (1, 1): -6.0, (1, 2): 6.0, (2, 2): -2.0}, 2.9)

        """
        qubo = dict(self.binary.quadratic)
        qubo.update(((v, v), bias) for v, bias in iteritems(self.binary.linear))
        return qubo, self.binary.offset
def to_qubo ( self ) : qubo = dict ( self . binary . quadratic ) qubo . update ( ( ( v , v ) , bias ) for v , bias in iteritems ( self . binary . linear ) ) return qubo , self . binary . offset
Convert a binary quadratic model to QUBO format.

        If the binary quadratic model's vartype is not :class:`.Vartype.BINARY`,
        values are converted.

        Returns:
            tuple: 2-tuple of form (`biases`, `offset`), where `biases` is a dict
            in which keys are pairs of variables and values are the associated linear or
            quadratic bias and `offset` is a number that represents the constant offset
            of the binary quadratic model.

        Examples:
            This example converts a binary quadratic model with spin variables to QUBO format
            with binary variables.

            >>> import dimod
            >>> model = dimod.BinaryQuadraticModel({0: 1, 1: -1, 2: .5},
            ...                                    {(0, 1): .5, (1, 2): 1.5},
            ...                                    1.4,
            ...                                    dimod.SPIN)
            >>> model.to_qubo()   # doctest: +SKIP
            ({(0, 0): 1.0, (0, 1): 2.0, (1, 1): -6.0, (1, 2): 6.0, (2, 2): -2.0}, 2.9)