Utilities

Decorators

stoppable(cls)

Extends a Runnable subclass with a stop_signal semaphore/event, and amends the existing halt and next methods to signal stop via the semaphore, and reset the stop signal on run completion, respectively.

Methods

bqm_density(bqm)

Calculate BQM's graph density.

bqm_edges_between_variables(bqm, variables)

Return edges connecting specified variables of a binary quadratic model.

bqm_induced_by(bqm, variables, sample)

Induce a binary quadratic model by fixing values of boundary variables.

bqm_reduced_to(bqm, variables, sample[, ...])

Reduce a binary quadratic model by fixing values of some variables.

chimera_tiles(bqm, m, n, t)

Map a binary quadratic model to a set of Chimera tiles.

cpu_count()

flip_energy_gains(bqm, sample[, variables, ...])

Order variable flips by descending contribution to energy changes in a BQM.

hstack_samplesets(base, *others, **kwargs)

Horizontally combine samples in base sampleset with samples in all the other samplesets provided in *others.

max_sample(bqm)

Return a sample with all variables set to the maximal value for a binary quadratic model.

min_sample(bqm)

Return a sample with all variables set to the minimal value for a binary quadratic model.

random_sample(bqm)

Return a random sample for a binary quadratic model.

random_sample_seq(size, vartype)

Return a random sample.

sample_as_dict(sample)

Return sample object in dict format.

sample_as_list(sample)

Return sample object in list format.

select_localsearch_adversaries(bqm, sample)

Find variable flips that contribute high energy changes to a BQM.

select_random_subgraph(bqm, n)

Select randomly n variables of the specified binary quadratic model.

updated_sample(sample, replacements)

Update a copy of a sample with replacement values.

vstack_samplesets(*samplesets)

Vertically combine *samplesets.

Classes

NumpyEncoder(*[, skipkeys, ensure_ascii, ...])

JSON encoder for numpy types.

OceanEncoder(*[, skipkeys, ensure_ascii, ...])

JSON encoder for common Ocean types.