dwave.system.composites.FixedEmbeddingComposite.child

FixedEmbeddingComposite.child

First child in children.

Examples

This example pseudocode defines a composed sampler that uses the first supported sampler in a composite’s list of samplers on a binary quadratic model.

class MyComposedSampler(Sampler, Composite):

    children = None
    parameters = None
    properties = None

    def __init__(self, child):
        self.children = [child]

        self.parameters = child.parameters.copy()  # propagate parameters
        self.parameters['my_additional_parameter'] = []

        self.properties = child.properties.copy()  # propagate properties

    # Implementation of the composite's functionality
    def sample(self, bqm, my_additional_parameter, **kwargs):
        # Overwrite the abstract sample method.
        # Additional parameters must have defaults

        # Samples are obtained from the sampler by using the `child` property:
        # response = self.child.sample(bqm, **kwargs)

        raise NotImplementedError