dimod.Sampler.properties

Sampler.properties

dict – A dict containing any additional information about the sampler.

Examples

This example adds a description property to an Ising sampler.

class IsingSampler(dimod.Sampler):
    def __init__(self):
        self._properties = {'description': 'an example Ising sampler'}

    def sample_ising(self, h, J):
        sample = linear_ising(h, J) # Implemented elsewhere
        energy = dimod.ising_energy(sample, h, J)
        return dimod.Response.from_dicts([sample], {'energy': [energy]})

    @property
    def properties(self):
        return self._properties

    @property
    def parameters(self):
        return dict()