MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / sample_problem

Method sample_problem

dwave/cloud/solver.py:1355–1402  ·  view source on GitHub ↗

Sample from the specified problem. Args: problem: A 3-tuple with linear/quadratic terms of the model and the offset. problem_type: Problem type, one of the handled problem types by the solver. undirected_biases:

(self,
                       problem: tuple[list | dict[int, float],
                                      dict[tuple[int, int], float],
                                      float],
                       *,
                       problem_type: Literal['ising', 'qubo'] = 'ising',
                       undirected_biases: bool = False,
                       label: str | None = None,
                       upload_params: dict | None = None,
                       **sample_params: Any,
                       )

Source from the content-addressed store, hash-verified

1353 return problem, params
1354
1355 def sample_problem(self,
1356 problem: tuple[list | dict[int, float],
1357 dict[tuple[int, int], float],
1358 float],
1359 *,
1360 problem_type: Literal['ising', 'qubo'] = 'ising',
1361 undirected_biases: bool = False,
1362 label: str | None = None,
1363 upload_params: dict | None = None,
1364 **sample_params: Any,
1365 ) -> Future:
1366 """Sample from the specified problem.
1367
1368 Args:
1369 problem:
1370 A 3-tuple with linear/quadratic terms of the model and the offset.
1371
1372 problem_type:
1373 Problem type, one of the handled problem types by the solver.
1374
1375 undirected_biases:
1376 Are (quadratic) biases specified on undirected edges? For
1377 triangular or symmetric matrix of quadratic biases set it to
1378 ``True``.
1379
1380 label:
1381 Problem label you can optionally tag submissions with for ease
1382 of identification.
1383
1384 upload_params:
1385 Optional upload/encode parameters, not used by structured solvers.
1386
1387 **sample_params:
1388 Sampling parameters, solver-specific.
1389
1390 Returns:
1391 Response in a future.
1392
1393 Note:
1394 :meth:`.sample_problem` accepts the native problem formulation for a
1395 solver, and for structured QPU solvers that's typically the Ising
1396 form. Calling ``sample_problem()`` with the default arguments is
1397 equivallent to calling :meth:`.sample_ising`.
1398 """
1399 linear, quadratic, offset = problem
1400 return self._sample(type_=problem_type, linear=linear, quadratic=quadratic,
1401 offset=offset, undirected_biases=undirected_biases,
1402 label=label, params=sample_params)
1403
1404 @dispatches_events('sample')
1405 def _sample(self, type_, linear, quadratic, offset, params,

Callers

nothing calls this directly

Calls 1

_sampleMethod · 0.95

Tested by

no test coverage detected