original_docstring: Sample from the specified binary quadratic model.
  
          Args:
              bqm (:class:`~dimod.BinaryQuadraticModel`):
                  Any binary quadratic model with up to
                  :attr:`.largest_clique_size` variables. This BQM is embedded
                  using a clique embedding.
  
              chain_strength (float/mapping/callable, optional):
                  Sets the coupling strength between qubits representing variables
                  that form a :term:`chain`. Mappings should specify the required
                  chain strength for each variable. Callables should accept the BQM
                  and embedding and return a float or mapping. By default,
                  `chain_strength` is calculated with
                  :func:`~dwave.embedding.chain_strength.uniform_torque_compensation`.
  
              **kwargs:
                  Optional keyword arguments for the sampling method, specified
                  per solver in :attr:`.parameters`.
                  D-Wave System Documentation's
                  `solver guide <https://docs.dwavesys.com/docs/latest/doc_solver_ref.html>`_
                  describes the parameters and properties supported on the D-Wave
                  system. Note that `auto_scale` is not supported by this
                  sampler, because it scales the problem as part of the embedding
                  process.
  
          Returns:
              :class:`~dimod.SampleSet`: Sample set constructed from a (non-blocking)
              :class:`~concurrent.futures.Future`-like object.
  
          
docstring: Sample from the specified binary quadratic model.
docstring_tokens: Sample from the specified binary quadratic model .
code: def sample(self, bqm, chain_strength=None, **kwargs):
          """Sample from the specified binary quadratic model.
  
          Args:
              bqm (:class:`~dimod.BinaryQuadraticModel`):
                  Any binary quadratic model with up to
                  :attr:`.largest_clique_size` variables. This BQM is embedded
                  using a clique embedding.
  
              chain_strength (float/mapping/callable, optional):
                  Sets the coupling strength between qubits representing variables
                  that form a :term:`chain`. Mappings should specify the required
                  chain strength for each variable. Callables should accept the BQM
                  and embedding and return a float or mapping. By default,
                  `chain_strength` is calculated with
                  :func:`~dwave.embedding.chain_strength.uniform_torque_compensation`.
  
              **kwargs:
                  Optional keyword arguments for the sampling method, specified
                  per solver in :attr:`.parameters`.
                  D-Wave System Documentation's
                  `solver guide <https://docs.dwavesys.com/docs/latest/doc_solver_ref.html>`_
                  describes the parameters and properties supported on the D-Wave
                  system. Note that `auto_scale` is not supported by this
                  sampler, because it scales the problem as part of the embedding
                  process.
  
          Returns:
              :class:`~dimod.SampleSet`: Sample set constructed from a (non-blocking)
              :class:`~concurrent.futures.Future`-like object.
  
          """
  
          # some arguments should not be overwritten
          if 'auto_scale' in kwargs:
              raise TypeError("sample() got an unexpected keyword argument "
                              "'auto_scale'")
          if 'bias_range' in kwargs:
              raise TypeError("sample() got an unexpected keyword argument "
                              "'bias_range'")
          if 'quadratic_range' in kwargs:
              raise TypeError("sample() got an unexpected keyword argument "
                              "'quadratic_range'")
  
          # handle circular import. todo: fix
          from dwave.system.composites.embedding import FixedEmbeddingComposite
  
          # get the embedding
          embedding = find_clique_embedding(bqm.variables, self.target_graph,
                                            use_cache=True)
  
          # returns an empty embedding when the BQM is too large
          if not embedding and bqm.num_variables:
              raise ValueError("Cannot embed given BQM (size {}), sampler can "
                               "only handle problems of size {}".format(
                                  len(bqm.variables), self.largest_clique_size))
  
          assert bqm.num_variables == len(embedding)  # sanity check
  
          # scaling only make sense in Ising space
          original_bqm = bqm
  
          if bqm.vartype is not dimod.SPIN:
              bqm = bqm.change_vartype(dimod.SPIN, inplace=False)
  
          sampler = FixedEmbeddingComposite(
              ScaleComposite(_QubitCouplingComposite(self.child)),
              embedding)
  
          if 'auto_scale' in self.child.parameters:
              kwargs['auto_scale'] = False
  
          sampleset = sampler.sample(bqm,
                                     bias_range=self.qpu_linear_range,
                                     quadratic_range=self.qpu_quadratic_range,
                                     chain_strength=chain_strength,
                                     **kwargs
                                     )
  
          # change_vartype is non-blocking
          return sampleset.change_vartype(original_bqm.vartype)
code_tokens: def sample ( self , bqm , chain_strength = None , ** kwargs ) : if 'auto_scale' in kwargs : raise TypeError ( "sample() got an unexpected keyword argument " "'auto_scale'" ) if 'bias_range' in kwargs : raise TypeError ( "sample() got an unexpected keyword argument " "'bias_range'" ) if 'quadratic_range' in kwargs : raise TypeError ( "sample() got an unexpected keyword argument " "'quadratic_range'" ) from dwave . system . composites . embedding import FixedEmbeddingComposite embedding = find_clique_embedding ( bqm . variables , self . target_graph , use_cache = True ) if not embedding and bqm . num_variables : raise ValueError ( "Cannot embed given BQM (size {}), sampler can " "only handle problems of size {}" . format ( len ( bqm . variables ) , self . largest_clique_size ) ) assert bqm . num_variables == len ( embedding ) original_bqm = bqm if bqm . vartype is not dimod . SPIN : bqm = bqm . change_vartype ( dimod . SPIN , inplace = False ) sampler = FixedEmbeddingComposite ( ScaleComposite ( _QubitCouplingComposite ( self . child ) ) , embedding ) if 'auto_scale' in self . child . parameters : kwargs [ 'auto_scale' ] = False sampleset = sampler . sample ( bqm , bias_range = self . qpu_linear_range , quadratic_range = self . qpu_quadratic_range , chain_strength = chain_strength , ** kwargs ) return sampleset . change_vartype ( original_bqm . vartype )
short_docstring: Sample from the specified binary quadratic model.
short_docstring_tokens: Sample from the specified binary quadratic model .
comment: """Sample from the specified binary quadratic model.
  
          Args:
              bqm (:class:`~dimod.BinaryQuadraticModel`):
                  Any binary quadratic model with up to
                  :attr:`.largest_clique_size` variables. This BQM is embedded
                  using a clique embedding.
  
              chain_strength (float/mapping/callable, optional):
                  Sets the coupling strength between qubits representing variables
                  that form a :term:`chain`. Mappings should specify the required
                  chain strength for each variable. Callables should accept the BQM
                  and embedding and return a float or mapping. By default,
                  `chain_strength` is calculated with
                  :func:`~dwave.embedding.chain_strength.uniform_torque_compensation`.
  
              **kwargs:
                  Optional keyword arguments for the sampling method, specified
                  per solver in :attr:`.parameters`.
                  D-Wave System Documentation's
                  `solver guide <https://docs.dwavesys.com/docs/latest/doc_solver_ref.html>`_
                  describes the parameters and properties supported on the D-Wave
                  system. Note that `auto_scale` is not supported by this
                  sampler, because it scales the problem as part of the embedding
                  process.
  
          Returns:
              :class:`~dimod.SampleSet`: Sample set constructed from a (non-blocking)
              :class:`~concurrent.futures.Future`-like object.
  
          """$SEP$# some arguments should not be overwritten$SEP$# handle circular import. todo: fix$SEP$# get the embedding$SEP$# returns an empty embedding when the BQM is too large$SEP$# sanity check$SEP$# scaling only make sense in Ising space$SEP$# change_vartype is non-blocking