SamplerBackend

SamplerBackend#

class iqm.qaoa.backends.SamplerBackend[source]#

Bases: ABC

The ABC for sampler backends, i.e., those returning samples from the QAOA.

Methods

sample(qaoa_object, shots)

The abstract method for sample() of backends subclassed from SamplerBackend.

abstract sample(qaoa_object, shots)[source]#

The abstract method for sample() of backends subclassed from SamplerBackend.

Parameters:
  • qaoa_object (QAOA) – A QAOA object to be sampled from.

  • shots (int) – The number of individual samples to take.

Returns:

A dictionary of samples. The keys are bitstrings and the values are their counts (which should add up to shots)

Return type:

dict[str, int]