hybrid.utils.max_sample#

max_sample(bqm)[source]#

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

Parameters:

bqm (BinaryQuadraticModel) – Binary quadratic model (BQM).

Returns:

A sample with maximal values for all variables of the BQM.

Return type:

dict

Examples

>>> import dimod
>>> bqm = dimod.BQM({}, {'ab': -1, 'bc': -1, 'ca': -1}, 0, 'BINARY')
>>> max_sample(bqm)     
{'a': 1, 'b': 1, 'c': 1}