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

Method test_submit_batch

tests/test_solver.py:386–404  ·  view source on GitHub ↗

Submit batch of problems.

(self)

Source from the content-addressed store, hash-verified

384 fi.samples
385
386 def test_submit_batch(self):
387 """Submit batch of problems."""
388
389 with Client(**config) as client:
390 solver = client.get_solver()
391
392 result_list = []
393 for _ in range(100):
394 linear, quad = generate_random_ising_problem(solver)
395 results = solver.sample_ising(linear, quad, num_reads=10)
396 result_list.append([results, linear, quad])
397
398 for results, linear, quad in result_list:
399 # Did we get the right number of samples?
400 self.assertEqual(10, sum(results.num_occurrences))
401
402 # Make sure the number of occurrences and energies are all correct
403 for energy, state in zip(results.energies, results.samples):
404 self.assertAlmostEqual(energy, evaluate_ising(linear, quad, state))
405
406 def test_cancel_batch(self):
407 """Submit batch of problems, then cancel them."""

Callers

nothing calls this directly

Calls 5

ClientClass · 0.90
evaluate_isingFunction · 0.90
get_solverMethod · 0.45
sample_isingMethod · 0.45

Tested by

no test coverage detected