dimod.keep_variables#

keep_variables(sampleset: SampleSet, variables: Iterable[Hashable]) SampleSet[source]#

Return a new sample set with only the given variables.

Parameters:
  • sampleset – A sample set.

  • variables – The variables to be kept. Must be a subset of the variables in the sample set.

Returns:

A new sampleset with only the given variables kept. The energies, info and other data vectors will be the same as in the given sample set.