Submit batch of problems.
(self)
| 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.""" |
nothing calls this directly
no test coverage detected